Troubleshooting
This page collates common errors from across the TramAI guides into a single reference.
Model Not Found
Symptom: ModelNotFoundException: Model 'xxx' is not mapped to any provider.
Cause: An operation references a model name that has not been mapped to a provider in your TramAI engine configuration.
Solution: Ensure every model is explicitly mapped:
val tramai = Tramai {
provider(OpenAiProvider(...), name = "openai")
model("gpt-4o", "openai") // required mapping
}
Structured Output Parsing Fails
Symptom: StructuredOutputException: Failed to parse AI response into type 'YourType'. Logs show invalid JSON or wrong schema.
Cause: The model failed to follow the requested output format. Common with smaller models.
Solutions:
- Use a more capable model (
gpt-4o,claude-sonnet-4-20250514) - Add explicit format instructions in your
@Operation(prompt = "...") - Check that retries are enabled — TramAI feeds validation errors back to the model on retry
- Default retries: 2. Configurable via
@Operation(maxRetries = N)
Provider Authentication Failures
Symptom: ProviderException: Unauthorized (401), AuthenticationException, or similar auth error.
Causes: Missing, invalid, expired, or rotated API key. Environment variable not picked up.
Solutions:
- Verify the environment variable:
echo $OPENAI_API_KEY - In Spring Boot, check
application.yaml:tramai: providers: openai: api-key: ${OPENAI_API_KEY} - Use
SecretValueResolverfor secure credential management - Check that the API key has not been rotated or revoked at the provider console
- For Azure OpenAI, verify the endpoint URL and API version are correct
Provider Timeout Errors
Symptom: ProviderException: Request timed out, java.net.SocketTimeoutException, or Read timed out.
Causes: Network latency, provider overload, or tight client timeouts.
Solutions:
- Increase the HTTP client timeout in your provider configuration
- Check network connectivity between your application and the provider endpoint
- Verify proxy/firewall settings if using a corporate network
- For Ollama, ensure the service is running and accessible:
curl http://localhost:11434/api/tags - Consider circuit breaker and retry configuration to handle transient timeouts
Provider Rate Limit Errors
Symptom: ProviderException: 429 Too Many Requests, RateLimitError, or Retry-After headers in logs.
Causes: Exceeding the provider's API rate limit or token-per-minute quota.
Solutions:
- Enable TramAI retry policy with exponential backoff (built into the engine):
retryPolicy( RetryPolicySettings( maxRetryAfterMillis = 20_000, jitterRatio = 0.1, ), ) - Reduce concurrent operation throughput
- Increase your provider plan tier if rate limits are consistently hit
- Implement a token-bucket rate limiter on your side for predictable usage
Spring Bean Injection Fails
Symptom: NoSuchBeanDefinitionException: No qualifying bean of type 'YourAiService' available.
Causes and solutions:
- Ensure
@AiServiceis on the interface, not an implementation class - Check that the interface is in a package scanned by Spring (under
@SpringBootApplicationor explicit@ComponentScan) - Verify the
tramai-springdependency is present on the classpath - If using
@EnableTramai, verify it is present on a configuration class
ClassNotFound / NoClassDefFoundError
Symptom: java.lang.NoClassDefFoundError: dev/tramai/core/... at runtime.
Cause: Missing optional module dependency.
Solution: Ensure all required modules are in your build file:
implementation("dev.tramai:tramai-standalone:0.3.1")
implementation("dev.tramai:tramai-openai:0.3.1")
TramAI modules are opt-in. You need:
tramai-standaloneortramai-springas the runtime entry point- at least one provider module (
tramai-openai,tramai-anthropic,tramai-ollama) tramai-structuredis pulled transitively by standalone/spring- optional modules:
tramai-observability,tramai-orchestration,tramai-scheduler,tramai-server,tramai-mcp,tramai-platform
Native Image Build Fails
Symptom: com.oracle.svm.core.jdk.proxy.DynamicProxyProxyCreationError or missing proxy at runtime.
Cause: @AiService interface not registered in GraalVM proxy-config.json.
Solution: Generate and include proxy metadata:
NativeImageProxyConfig.write(
outputPath = Path.of("src/main/resources/META-INF/native-image/.../proxy-config.json"),
InvoiceAnalyzer::class,
)
See Native Image for the full workflow.
Native Image: Reflection Errors
Symptom: java.lang.ClassNotFoundException or reflective access errors in native image.
Cause: TramAI or provider libraries need reflection hints not included in the image.
Common fixes:
- Add
--enable-url-protocols=httpsif using HTTPS providers - Add Jackson reflection hints for your data classes
- Add
-H:ReflectionConfigurationFiles=...for provider-specific reflection - Test with
-H:+ReportUnsupportedElementsAtRuntimefor diagnostics
Spring Boot Configuration Issues
Symptom: TramAI beans are not configured as expected, or auto-configuration fails silently.
Common causes:
| Symptom | Likely cause | Fix |
|---|---|---|
| Wrong model used | Property typo in application.yaml | Check tramai.models.* keys |
| Default model not set | Missing tramai.default-model | Add tramai.default-model: gpt-4o |
| Provider not found | Missing provider section or API key | Check tramai.providers.* |
| DLP not working | Multiple DlpInterceptor beans | Define exactly one |
| Observability missing | OTel not on classpath | Add tramai-observability dep |
| Auto-config skipped | tramai.enabled=false | Remove or set to true |
Provider-Specific Errors
| Provider | Common Error | Cause | Fix |
|---|---|---|---|
| OpenAI | 429 Too Many Requests | Rate limit exceeded | Increase retry budget or reduce concurrency |
| Anthropic | 529 Overloaded | Anthropic server overload | Retry with backoff — built into engine |
| Ollama | Connection refused | Ollama not running locally | Start ollama serve or check base URL |
| Azure OpenAI | 401 Unauthorized | Wrong endpoint or API version | Verify endpoint URL and API version |
| Bedrock | AccessDeniedException | Missing AWS IAM permissions | Check role policy for Bedrock access |
Builder Configuration Mistakes
Common mistakes when using the Tramai { ... } builder DSL.
| Symptom | Cause | Fix |
|---|---|---|
IllegalArgumentException: Provider 'xxx' not found | Model references a provider name that was never registered | Check provider(...) call — the name parameter must match the model mapping |
IllegalStateException: No default provider | No provider was marked default = true but the model has no explicit provider route | Add default = true to one provider or always qualify model names |
MissingMethodException: No signature of method | DSL block references a method not available in the current module | Check that the required dependency (e.g. tramai-orchestration) is on the classpath |
| Model silently falls back | fallbackModel was configured but the fallback provider is missing or misconfigured | Verify both primary and fallback providers are registered and healthy |
NullPointerException in builder | Required property not set (e.g. API key is null) | Ensure all required properties are provided before passing to the builder |
Orchestration Errors
Symptom: ExperimentalTramAIOrchestration opt-in required.
Cause: The orchestration module is marked experimental in code.
Fix: Add the opt-in annotation:
@OptIn(ExperimentalTramAIOrchestration::class)
fun buildWorkflow() {
// workflow code here
}
Scheduler Errors
| Symptom | Cause | Fix |
|---|---|---|
| Cron expression invalid | Wrong field count or values | Use 5 or 6 fields; check minutes (0-59), hours (0-23) |
| Schedule never fires | Business-hours filter active | Check businessHoursOnly config |
| Misfired ticks | Worker was down | Check misfireThreshold; increase if needed |
| Delay step never resumes | Scheduler polling not configured | Ensure ScheduledWorkflowTimer is running |
Server Errors
| Symptom | Cause | Fix |
|---|---|---|
| 400 Bad Request | Invalid workflow JSON | Check initial state matches workflow state type |
| 401 Unauthorized | Invalid webhook signature | Verify tramai.server.webhooks.secret |
| 413 Request Too Large | Body exceeds limit | Increase max-request-body-bytes |
| 404 Not Found | Unknown workflow or run name | Check workflow registration and run ID |
| SSE stream ends early | Run reached terminal state | This is expected — check status for result/error |
Platform Errors
| Symptom | Cause | Fix |
|---|---|---|
| 401 on platform endpoints | Missing or invalid API key | Provide X-API-Key header |
| 403 Forbidden | Key lacks required scope | Check key scopes include run/read/admin |
| 429 Too Many Requests | Rate limit exceeded | Check Retry-After header; increase key capacity |
| Plugin not found | JAR not in plugin directory | Drop JAR in tramai.platform.plugins.dir and enable via API |
| Team/project not found | Tenant bootstrap pending | Create team/project via repository or seed data |
Logging Diagnostics
Enable DEBUG logging for TramAI internals to trace execution:
logging:
level:
dev.tramai: DEBUG
This reveals:
- provider resolution decisions
- retry attempt pacing
- structured output parsing details
- circuit breaker state transitions
- interceptor execution order
Still Having Trouble?
- Enable DEBUG logging for
dev.tramaito see detailed execution traces - Check the GitHub Issues for known problems
- Review the relevant guide page for your use case:
