Skip to main content

Error Reference

This document catalogs every error type in Constellation Engine with error codes, causes, and resolution steps.

Error Structure

All Constellation errors extend the ConstellationError trait:

sealed trait ConstellationError extends Exception {
def message: String
def errorCode: String
def context: Map[String, String]
def category: String
def toJson: Json
}

JSON Format

Errors serialize to a consistent JSON shape:

{
"error": "TYPE_MISMATCH",
"category": "type",
"message": "Expected String but got Int",
"context": {
"expected": "String",
"actual": "Int",
"location": "argument 1 of Uppercase"
}
}

Error Categories

CategoryPrefixWhen
typeTYPE_Type checking and conversion failures
compilerVariousCompilation-phase errors
runtimeVariousExecution-phase errors
executionExceptionsLifecycle and scheduling errors
httpHTTP status codesHTTP API errors

Quick Debugging Guide

Most Common Errors

ErrorLikely CauseQuick Fix
"field not found"Typo in field nameCheck spelling, use autocomplete
"type mismatch"Wrong type in operationCheck expected vs actual types
"module not found"Missing module registrationVerify module is registered in Scala
"cannot unify types"Incompatible merge/projectionUse explicit type annotation

Debugging Steps

  1. Read the error location — Line and column point to the exact problem
  2. Check the expected type — Error shows what was expected vs found
  3. Hover in VSCode — See inferred types at any expression
  4. Simplify the expression — Break complex expressions into steps

Error Code Ranges

RangeCategoryExample
E001-E099Parse errorsSyntax issues, missing tokens
E100-E199Type errorsType mismatches, field access
E200-E299Semantic errorsUndefined variables, cycles
E300-E399Runtime errorsModule failures, timeouts

Type Errors

Category: type

TYPE_MISMATCH

FieldValue
ClassTypeMismatchError
CodeTYPE_MISMATCH
MessageExpected {expected} but got {actual}
Contextexpected, actual

Cause: A value's type does not match what was expected. Common scenarios:

  • Passing a String where an Int is required
  • Function return type does not match declared output type
  • Merge operands have incompatible types

Resolution:

  • Check the function signature to verify parameter types
  • Ensure input declarations in your .cst script match the data you provide
  • Use the compiler error position to locate the mismatch

TYPE_CONVERSION

FieldValue
ClassTypeConversionError
CodeTYPE_CONVERSION
MessageCannot convert {from} to {to}: {reason}
Contextfrom, to, reason

Cause: The runtime failed to convert a value from one type to another. Typically occurs when JSON input values cannot be coerced to the expected CType.

Resolution:

  • Verify your JSON inputs match the declared types (e.g., send 42 not "42" for Int)
  • Check that list elements are homogeneous
  • Ensure struct fields match the expected schema

Compiler Errors

Category: compiler

NODE_NOT_FOUND

FieldValue
ClassNodeNotFoundError
CodeNODE_NOT_FOUND
MessageNode {nodeId} of type {nodeType} not found
ContextnodeId, nodeType

Cause: An internal compiler reference points to a node that does not exist in the DAG. This is typically an internal compiler error rather than a user error.

Resolution:

  • Report this as a bug with the constellation-lang source that triggered it
  • Simplify the script to isolate which construct triggers the error

UNDEFINED_VARIABLE

FieldValue
ClassUndefinedVariableError
CodeUNDEFINED_VARIABLE
MessageUndefined variable: {variableName}
ContextvariableName

Cause: The script references a variable name that has not been declared. Common scenarios:

  • Typo in a variable name
  • Using a variable before declaring it
  • Referencing a variable from a different scope

Resolution:

  • Check spelling — the compiler may suggest "did you mean?" alternatives
  • Ensure the variable is declared with in, assigned via =, or is an output of a prior function call
  • Variable names are case-sensitive

CYCLE_DETECTED

FieldValue
ClassCycleDetectedError
CodeCYCLE_DETECTED
MessageCycle detected involving nodes: {nodeIds}
ContextnodeIds (comma-separated UUIDs)

Cause: The compiled DAG contains a circular dependency. A module's output feeds back (directly or transitively) into its own input.

Resolution:

  • Review the data flow in your script for circular references
  • Break the cycle by introducing an intermediate variable or restructuring the pipeline

UNSUPPORTED_OPERATION

FieldValue
ClassUnsupportedOperationError
CodeUNSUPPORTED_OPERATION
MessageUnsupported operation: {operation} — {reason}
Contextoperation, reason

Cause: The script uses a language construct that is not supported in the current context. Examples:

  • Merging incompatible types (e.g., Int + String)
  • Projecting fields from a non-record type
  • Using an unsupported operator

Resolution:


Runtime Errors

Category: runtime

MODULE_NOT_FOUND

FieldValue
ClassModuleNotFoundError
CodeMODULE_NOT_FOUND
MessageModule not found: {moduleName}
ContextmoduleName

Cause: The DAG references a module that has not been registered with the Constellation instance. The script compiled successfully (the function signature was known), but the runtime module implementation is missing.

Resolution:

  • Register the module before execution: constellation.setModule(myModule)
  • Verify the module name in ModuleBuilder.metadata() matches exactly (case-sensitive)
  • Ensure all standard library modules are registered: StdLib.allModules.values.toList.traverse(constellation.setModule)

MODULE_EXECUTION

FieldValue
ClassModuleExecutionError
CodeMODULE_EXECUTION
MessageModule '{moduleName}' execution failed
ContextmoduleName, plus optional cause

Cause: A module threw an exception during execution. The cause field (if present) contains the original exception.

Resolution:

  • Check the module implementation for unhandled exceptions
  • Verify the input data matches what the module expects
  • For IO-based modules, ensure external services are reachable
  • Check the cause context field for the underlying error message

INPUT_VALIDATION

FieldValue
ClassInputValidationError
CodeINPUT_VALIDATION
MessageInput validation failed for '{inputName}': {reason}
ContextinputName, reason

Cause: An input value provided to the DAG failed validation. Common scenarios:

  • Missing required input
  • Value type does not match the declared input type
  • Value is outside acceptable range (if module validates)

Resolution:

  • Provide all inputs declared in the script's in declarations
  • Ensure JSON values match declared types:
    • String → JSON string
    • Int → JSON number (integer)
    • Boolean → JSON boolean
    • List<T> → JSON array

DATA_NOT_FOUND

FieldValue
ClassDataNotFoundError
CodeDATA_NOT_FOUND
MessageData not found: {dataId} ({dataType})
ContextdataId, dataType

Cause: The runtime attempted to read a data node that has not been populated. This can happen if an upstream module failed silently or if the DAG structure is inconsistent.

Resolution:

  • Check upstream module statuses in Runtime.State.moduleStatuses
  • Verify the DAG compiled without warnings
  • This may indicate a compiler bug — report with the source script

RUNTIME_NOT_INITIALIZED

FieldValue
ClassRuntimeNotInitializedError
CodeRUNTIME_NOT_INITIALIZED
MessageRuntime not initialized: {reason}
Contextreason

Cause: An operation was attempted before the runtime was fully initialized.

Resolution:

  • Ensure ConstellationImpl.init or .builder().build() has completed before calling execution methods
  • In IOApp, use for/yield or flatMap to sequence initialization before execution

VALIDATION_ERROR

FieldValue
ClassValidationError
CodeVALIDATION_ERROR
MessageValidation failed: {errors} (newline-separated)
Contexterrors

Cause: Multiple validation errors occurred. The errors list contains individual error messages.

Resolution:

  • Address each error in the list individually
  • This often occurs when multiple inputs are invalid simultaneously

Execution Lifecycle Errors

These are thrown as exceptions (not ConstellationError subtypes) during execution lifecycle operations.

CircuitOpenException

FieldValue
ClassCircuitOpenException
MessageCircuit breaker is open for module: {moduleName}

Cause: The circuit breaker for a module is in the Open state, meaning the module has exceeded its failure threshold and calls are being rejected to prevent cascading failures.

Resolution:

  • Wait for the circuit breaker's resetDuration to elapse (default: 30 seconds)
  • Check the underlying module for persistent failures (external service down, configuration error)
  • Monitor circuit state via circuitBreaker.stats
  • Adjust CircuitBreakerConfig.failureThreshold if the module has transient failures

QueueFullException

FieldValue
ClassQueueFullException
MessageScheduler queue is full (max: {maxQueueSize})

Cause: The bounded scheduler's queue has reached its maximum capacity. New tasks cannot be accepted.

Resolution:

  • Increase maxQueueSize in the scheduler configuration
  • Increase maxConcurrency to process tasks faster
  • Implement backpressure in your application (reject or queue requests upstream)
  • Monitor queue depth via scheduler.stats.queuedCount

ShutdownRejectedException

FieldValue
ClassShutdownRejectedException
MessageExecution rejected: system is shutting down

Cause: A new execution was submitted after ConstellationLifecycle.shutdown() was called. The system is draining in-flight executions and rejecting new ones.

Resolution:

  • This is expected behavior during graceful shutdown
  • Ensure your application stops submitting new work after initiating shutdown
  • Check lifecycle.state before submitting — only submit when state is Running

HTTP Error Responses

These are HTTP status codes returned by the API server, not ConstellationError types.

401 Unauthorized

{
"error": "Unauthorized",
"message": "Missing or invalid Authorization header"
}

Cause: Authentication is enabled and the request either lacks an Authorization: Bearer <key> header or the provided key is not in the configured key map.

Resolution:

  • Include Authorization: Bearer <your-api-key> header
  • Verify the API key is correctly configured in AuthConfig
  • Check for whitespace or encoding issues in the header value

403 Forbidden

{
"error": "Forbidden",
"message": "Insufficient permissions for POST"
}

Cause: The API key is valid but the associated role does not permit the requested HTTP method.

Resolution:

  • Use a key with the appropriate role (see Security Model for role permissions)
  • ReadOnly keys can only GET; Execute keys can GET and POST; Admin keys can use all methods

429 Too Many Requests

HTTP/1.1 429 Too Many Requests
Retry-After: 12

Cause: The client IP has exceeded the configured rate limit.

Resolution:

  • Wait for the duration indicated by the Retry-After header
  • Reduce request frequency
  • If legitimate traffic, increase requestsPerMinute and burst in RateLimitConfig

503 Service Unavailable

{
"ready": false,
"reason": "System is draining"
}

Cause: The readiness probe (/health/ready) returned not-ready. This occurs when:

  • The system is in Draining or Stopped lifecycle state
  • A custom readiness check failed

Resolution:

  • If during shutdown, this is expected — the load balancer should route traffic elsewhere
  • If unexpected, check custom readiness checks and lifecycle state via /health/detail

constellation-lang Parse and Compile Errors

Parse and compile errors from the constellation-lang compiler use a separate error hierarchy (CompileError) with source position information. These are documented in detail in the Error Messages Guide.

Common categories:

ErrorExample
ParseErrorUnexpected token at line 3, column 5
UndefinedVariableUndefined variable: textt (with "did you mean: text?")
UndefinedFunctionUndefined function: Upppercase (with suggestion)
TypeMismatchExpected Int in argument 1 of Add, got String
InvalidProjectionField 'score' does not exist on record {name: String}
IncompatibleMergeCannot merge Int with String

All compile errors include:

  • Position — line and column number
  • Error code — E001-E900 (see ErrorCode.scala)
  • Suggestions — "did you mean?" based on Levenshtein distance
  • Formatted output — code snippet with caret marker pointing to the error location