How to Interpret Archify's Diagnostic Codes and Messages
Archify emits structured JSON diagnostics containing stable error codes, human-readable messages, JSON pointers to offending elements, and actionable repair suggestions that enable both manual debugging and programmatic error resolution.
When you validate architecture diagrams with tt-a1i/archify, the tool returns detailed diagnostic feedback through its CLI. Understanding how to interpret Archify's diagnostic codes and messages allows you to rapidly identify and repair issues in your typed JSON Intermediate Representation (IR) before rendering. The diagnostic system is designed to be deterministic and machine-readable, making it ideal for CI/CD pipelines and automated tooling.
Anatomy of an Archify Diagnostic Object
Each diagnostic entry in the diagnostics array follows a strict schema. When you run Archify with the --json flag, the CLI outputs an object containing this array, with each element providing five critical fields:
- code: A stable, uppercase identifier (e.g.,
MISSING_LABEL,INVALID_ROUTE) that remains consistent across runs for programmatic filtering. - message: Human-readable text explaining the validation failure, typically including specific node or edge IDs affected by the error.
- subject: A JSON Pointer (RFC 6901) such as
/nodes/5that pinpoints the exact location of the problematic element in your IR file. - supportedFixes: An array of permissible repair actions (e.g.,
addLabel,removeEdge) that the CLI will accept during subsequent validation or delivery attempts. - evidence: Optional contextual data such as source code snippets or Git commit references that help trace the error to its origin.
According to the README.md in tt-a1i/archify (lines 223–226), this structure ensures diagnostics are self-contained and environment-agnostic, functioning identically across Cursor, Claude Code, Codex CLI, and OpenCode.
Retrieving Diagnostics with the --json Flag
To capture diagnostic output in a parseable format, append the --json flag to any validate or deliver command. The archify/bin/archify.mjs entry point handles all CLI commands including validate, compare, and deliver. For example, validating an architecture file produces a JSON object you can inspect programmatically:
node archify/bin/archify.mjs validate architecture examples/web-app.json \
--quality showcase --json > result.json
When validation fails, the resulting JSON object's diagnostics field contains the array of error descriptions, as documented in README.md (lines 232–236).
Resolving Errors Using the Diagnostic Workflow
Follow this systematic approach to interpret and fix validation failures:
- Extract the diagnostic dump: Run your command with
--jsonand pipe the output to a file for inspection. - Locate the failure point: Check the
subjectfield to identify the JSON Pointer path (e.g.,/nodes/3) requiring modification. - Interpret the requirement: Review the
codeandmessagefields to understand what constraint was violated. - Select a fix: Choose one option from the
supportedFixesarray—such asaddLabelfor aMISSING_LABELerror—and apply the corresponding change to your IR. - Re-validate: Execute the validation command again. If the
diagnosticsarray is empty, Archify will proceed to render the diagram.
For batch processing, use jq to filter specific error types from the output:
jq '.diagnostics[] | select(.code == "MISSING_LABEL") | {message, subject, supportedFixes}' result.json
Programmatic Consumption in Node.js
You can integrate Archify's diagnostic system directly into Node.js scripts by invoking the CLI and parsing the JSON response:
const { execSync } = require('child_process');
const result = JSON.parse(execSync(
'node archify/bin/archify.mjs validate architecture examples/web-app.json --quality showcase --json'
));
for (const d of result.diagnostics) {
console.log(`[${d.code}] ${d.message} (at ${d.subject})`);
console.log('Suggested fixes:', d.supportedFixes.join(', '));
}
This pattern enables automated error reporting in CI pipelines or LLM-driven code editors that can propose fixes based on the supportedFixes metadata.
Key Source Files and Schema Definitions
Understanding these files in the tt-a1i/archify repository provides deeper context for diagnostic interpretation:
README.md(lines 223–236): Documents the CLI--jsonoutput format and the complete structure of thediagnosticsarray.archify/bin/archify.mjs: The main CLI entry point that instantiates the validation engine and formats diagnostic output.archify/schemas/diagnostic.json: If present, contains the formal JSON Schema defining valid diagnostic object shapes and enumerated fix types.archify/examples/web-app.json: Sample IR file that demonstrates common validation scenarios and corresponding diagnostic triggers.archify/docs/authoring-cookbook.md: Provides guidance on authoring IR files and interpreting validation feedback in complex architectures.
Summary
- Archify's diagnostic system returns machine-readable JSON through the
--jsonCLI flag, enabling both manual and automated error handling. - Each diagnostic contains a stable
code, descriptivemessage, JSON Pointersubject, and actionablesupportedFixesarray. - The
validateanddelivercommands inarchify/bin/archify.mjsnever mutate source files, allowing safe iterative debugging. - Integration with tools like
jqor Node.jschild_processsupports CI/CD automation and LLM-assisted repair workflows.
Frequently Asked Questions
What do Archify diagnostic codes look like?
Diagnostic codes are uppercase, snake-case strings such as MISSING_LABEL or INVALID_ROUTE. These codes are stable identifiers defined in the Archify validation engine, allowing you to filter logs or write conditional logic that handles specific error types consistently across different versions of the tool.
How do I find which element caused a diagnostic?
Inspect the subject field in the diagnostic object, which contains a JSON Pointer (e.g., /nodes/5/label) referencing the exact location in your IR file. This pointer follows RFC 6901 syntax and can be used with JSON parsing libraries or manual navigation to locate the offending node or edge.
Can I automate fixes based on Archify diagnostics?
Yes. The supportedFixes array lists permissible repair actions for each diagnostic, such as addLabel or removeEdge. Your automation scripts can map these codes to specific code transformations, then re-run the validation command to confirm resolution without manual intervention.
Where are diagnostic definitions stored in the repository?
While the runtime logic resides in archify/bin/archify.mjs, the schema definitions and documentation are located in README.md (lines 232–236) and potentially archify/schemas/diagnostic.json. The archify/docs/authoring-cookbook.md file provides additional context on how validation rules generate specific diagnostic patterns.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →