ArchLex Error Codes
ArchLex returns structured diagnostics with parse, analysis, and render results. Use each diagnostic’s code, severity, source span, and remediation to show a useful correction beside the diagram source.
const result = await archlex.render(source);
for (const diagnostic of result.diagnostics) {
console.log(`${diagnostic.code}: ${diagnostic.message}`);
console.log(`Fix: ${diagnostic.remediation}`);
}Diagnostic Families
| Prefix | Stage | What to check |
|---|---|---|
AL-PARSE-* | Parser | Directive syntax, resource declarations, relationship endpoints, and block delimiters |
AL-STRUCT-* | Structural analysis | Duplicate IDs, missing references, invalid containment, and conflicting declarations |
AWS-* | AWS semantics | AWS resource names, scopes, containment, and provider relationships |
GCP-* | Google Cloud semantics | Google Cloud resource names, scopes, containment, and provider relationships |
K8S-* | Kubernetes semantics | Kubernetes resource names, cluster and namespace placement, and workload relationships |
CLOUDFLARE-* | Cloudflare semantics | Cloudflare resource placement at root or in a logical account |
Icon warnings report unresolved or rejected icon assets. They do not change the provider semantic rules.
Severity
erroridentifies source that ArchLex cannot interpret or validate as a usable graph.warningidentifies a graph that ArchLex can render with a likely modeling problem.infogives provider guidance without blocking output.
ArchLex can return a partial graph or SVG with diagnostics. Check the result instead of treating a rendered SVG as proof that the source has no errors.
Validation Modes
Set the mode with the validation directive or the matching API option:
validation normal| Mode | Behavior |
|---|---|
normal | Runs the standard structural and provider checks |
strict | Promotes supported advisory findings to stricter diagnostics |
off | Skips provider semantic rules while retaining parsing and graph construction checks |
Provider specifications describe the rules that each mode affects:
Fix a Diagnostic
- Find the diagnostic code and source span in the result.
- Read its
remediationfield. - Open the code in the error code list when you need its full reference page.
- Update the source, then render it again.
Error Codes
Complete reference of all diagnostic codes.
Parse
- 🔴 AL-PARSE-001 - Unexpected token ’${token}’
- 🔴 AL-PARSE-002 - Syntax error: ${details}
- 🔴 AL-PARSE-MISSING-ENDPOINT - Expected relationship endpoint after arrow operator
- 🔴 AL-PARSE-MISSING-BRACE - Expected closing brace ’}’ for ${scopeType} block
Structural
- 🔴 AL-STRUCT-DUPLICATE-ID - Resource ‘{line}:${column}
- 🔵 AL-STRUCT-CONFLICTING-LABEL - Display label for ’${id}’ conflicts with previous definition
- 🔴 AL-STRUCT-DUPLICATE-DIRECTIVE - Duplicate ‘{directiveName} directive is allowed.
- 🔴 AL-STRUCT-LATE-DIRECTIVE - Directive ’${directiveName}’ must appear before all resource and relationship declarations
- 🔴 AL-STRUCT-INVALID-DIRECTIVE - Invalid value ‘{directiveName}’ directive
Semantic
- 🔵 AL-SEM-UNKNOWN-RESOURCE - Unknown service type ‘{provider}’
- 🔵 AL-SEM-UNKNOWN-RELATIONSHIP - Unknown relationship type ‘{leftKind}’ and ’${rightKind}’
- 🔵 AL-SEM-EMPTY-GRAPH - Document contains no resources or relationships
Last updated on