Skip to content
Published beta · next channelRead as Markdown

Error codes ​

Mimlet errors that callers may need to handle carry a stable code. Branch on the error class or its code, never on the message: message wording, stack traces and cause chains can change. The stability contract treats these codes as machine-readable API. New codes may be added; existing codes keep their meaning. CLI reports use a separate set of diagnostic codes.

Some guards are plain TypeErrors without a code, for example a missing session for Effect or Faker builders, or loading @mimlet/effect with Effect 3. Treat those as programming errors, not states to branch on.

Core (@mimlet/core) ​

ClassCodeWhen
BuilderValidationErrorVALIDATION_FAILEDA validated build was rejected by its schema. The validator's issues are on the non-enumerable issues property.
BuilderGenerationErrorGENERATION_FAILEDGeneration could not produce a value, for example a selected union variant that does not satisfy the enclosing union.
BuilderPathErrorINVALID_BUILDER_PATHA typed path operation received a path that does not exist on the value. Extends TypeError.
FixtureCaptureErrorUNSUPPORTED_FIXTURECapture met a value it cannot record, such as a class instance, function, accessor, promise or weak collection.
CAPTURE_LIMITCapture exceeded its size or depth budget.
INVALID_CAPTUREA capture record being restored is malformed or uses an unsupported format.
ScenarioErrorSCENARIO_DEFINITIONA scenario definition is invalid. The error names the node.
SCENARIO_CONFLICTA trait was applied twice, or conflicts with an existing node override.
SCENARIO_EXECUTIONA scenario node failed while building; the original error is the cause.
SessionBudgetErrorSESSION_BUDGET_EXHAUSTEDA generation session ran out of its operation, tracked-key, unique-value or uniqueness-attempt budget.
SessionReplayErrorINVALID_SESSION_REPLAYA session replay is malformed, or its fingerprint, provider/version or configuration does not match.

Adapters and schema packages ​

PackageClassCodeWhen
@mimlet/adapterAdapterDefinitionErrorINVALID_ADAPTER_DEFINITIONdefineAdapter received invalid metadata or operations. Extends TypeError.
@mimlet/json-schemaSchemaPreparationErrorSCHEMA_PREPARATION_FAILEDA schema or one of its references could not be prepared for generation.
SchemaGenerationErrorSCHEMA_GENERATION_FAILEDBounded generation could not produce a valid value. This does not prove none exists.
NegativeCaseErrorNEGATIVE_CASE_MISMATCHA negative case did not fail validation with the expected number of issues.
@mimlet/fakerFakerSessionErrorFAKER_SESSION_RECONFIGURATIONCode tried to reseed a session-scoped Faker instance; create or restore a session instead.
@mimlet/fast-checkPropertyIntegrationErrorPROPERTY_CONFIGURATIONA property check is misconfigured, for example without a fingerprint and provider/version.
PROPERTY_REPLAYA property replay's version, engine, identity or path does not match.
FixturePropertyErrorPROPERTY_FAILEDA fixture property failed; its report getter holds the counterexample and replay record.

Protocol packages ​

PackageClassCodeWhen
@mimlet/apiApiContractErrorAPI_CONTRACT_FAILEDAn OpenAPI or AsyncAPI document, operation or message cannot be used.
@mimlet/graphqlGraphQLFixtureErrorGRAPHQL_FIXTURE_FAILEDA GraphQL schema, operation or output type cannot be generated.
@mimlet/protobufProtobufFixtureErrorPROTOBUF_FIXTURE_FAILEDA Protobuf schema could not be prepared, or a message failed to decode.
@mimlet/avroAvroFixtureErrorAVRO_FIXTURE_FAILEDAn Avro schema failed to compile or a value does not fit it; the error carries the path.

Tooling ​

PackageClassCodeWhen
@mimlet/codegenCodegenErrorCODEGEN_FAILEDGeneration arguments or configuration are invalid, or output could not be emitted.
@mimlet/playgroundPlaygroundErrorINVALID_REQUESTThe playground received a malformed generation request.
GENERATION_TIMEOUTGeneration exceeded its time budget.
GENERATION_ABORTEDGeneration was cancelled.
GENERATION_FAILEDGeneration failed in the playground's child process.

Mimlet · beta · MIT licensed