specgate/docs v1.8.0

Troubleshooting#

Find your problem by what you see, or by the code in brackets at the end of an error line, such as [matrix_stale]. Every error Specgate prints already says how to fix it; this page adds the cause and the context.

First, run the built-in diagnosis. It checks the environment, the project structure and the traceability in both directions, and prints a fix for each finding:

bash
specgate doctor

Index by code#

CodesSection
tests_not_configured, check_tests_failed, check_arch_failed, check_validate_failed, check_change_invalid, scenario_steps_unwritten, scenario_placeholder_step, scenario_not_covered, [TDD-1], declared_artifact_missing, requirement_template_obligation, id_taken_on_base, matrix_staleThe gate
apply_no_test, done_validate_failed, done_tests_failed, done_needs_clarification, archive_requirements_pending, archive_draft_not_readyApply and archive
D1–D12, draft_no_brief, draft_module_not_in_brief, draft_agent_failed, draft_agent_needs_git, draft_brief_text_lost, draft_brief_body_changedDrafting
T1–T9, ticket_*, pr_failed, change_overlap, change_id_clash, change_base_movedTickets
requirement_scenario_unrunnable, agent_rewrote_gate_commandHarness
alm_config_unread_keyTickets

Installation#

SymptomCauseFix
npx specgate runs something else, or asks to installThe package is not installed in this projectnpm install --save-dev @rsaglobaltech/specgate, then npx specgate …
You want to try it without installing—npx @rsaglobaltech/specgate@latest …
A syntax error or an engine warning at startNode.js older than 22Install Node.js 22 or later
The first npx @rsaglobaltech/specgate@latest is slownpm downloads the package onceLater runs use the cache; CI pins a version (see CI)

Upgrading a project from 0.18 or earlier#

Since 0.19 everything is called specgate: the markers in your specs (<!-- specgate:trace … -->), the .specgate/ folder and the SPECGATE_* variables. A project still on the old csda: format fails validate with old_format, and the message names the command that migrates it, once (ADR-0032). After any upgrade, run specgate update: it refreshes the agent contract in AGENTS.md and the agent commands to the installed version.

The gate#

specgate check is the gate: it validates the specification, runs your architecture check when one is set, then runs your tests. The most common failures on a first pull request are explained with examples in Your team's first PR.

Code or symptomCauseFix
"checked the specification, not the code" (tests_not_configured)No test command is configured, so no test ranspecgate config set test_cmd "npm test" (any command your project uses)
check_tests_failedYour tests failedRead the test output above the line and fix the code or the test
check_arch_failedThe architecture check (arch_cmd) failedMove the code to the layer the rule names; do not change the rule
check_validate_failedThe specification has errorsFix each finding listed above it
check_change_invalid, scenario_steps_unwrittenAn open change has a scenario still holding <placeholders>Write the real Given/When/Then steps; specgate change validate <id> lists all
scenario_placeholder_stepA feature file of a requirement being delivered still has placeholdersWrite the real steps
scenario_not_coveredNo test names the scenarioName it in the test that proves it (SCN-007a)
[TDD-1]A requirement past Draft with no test that names itName REQ-007 in its test, or set it back to Draft
declared_artifact_missingA path written in a requirement's trace comment no longer existsRestore the file or correct the path
requirement_template_obligationA requirement claims delivery but still has the template sentenceWrite the real obligation
id_taken_on_baseAnother branch merged the same requirement id with another titleRenumber yours to the id the message suggests
matrix_stale (CI only)docs/specs/traceability.md was not committed after a changeRun specgate check locally and commit the matrix
A merge conflict in traceability.mdA hand-kept matrix; a generated one merges by itselfSee Parallel branches and the matrix

The traceability matrix (docs/specs/traceability.md) is generated from the specs, the feature files and the tests. Never add or edit its rows by hand; fix the source and let specgate check regenerate it.

Apply and archive#

CodeCauseFix
apply_no_testNo test names the requirement yetWrite the test first and name REQ-007 in it
done_validate_failedapply ran the gate and it failed; nothing was writtenFix what is listed above it and run apply again
done_tests_failedThe tests failed during applyFix them; apply marks nothing until they pass
done_needs_clarificationThe requirement waits for an answer to an open questionAnswer it in questions.md, then remove Needs Clarification from its trace
archive_requirements_pendingA requirement of the change is not ImplementedRun the specgate apply REQ-… it names; --force does not skip this
archive_draft_not_readyA change opened from a brief or a ticket has open checklist findingsRun the propose command it names and fix the findings

apply never commits. Commit after each requirement, and after archive.

Drafting#

A draft is a change opened from a brief or a ticket. The D-rules are the drafting checklist that runs on it, D1 to D12; each is explained in From a client brief.

Code or symptomCauseFix
draft_no_briefNo docs/brief.mdspecgate propose --from-brief --new-brief writes one to fill in
draft_module_not_in_briefThe module is not listed under modules: in the briefAdd it there
draft_guide_no_modules--guide cards on a brief whose front matter lists no modulespecgate propose --from-brief --guide setup first
D6: a value is not in the briefThe draft uses a number or a name its source does not stateAsk the client, or record it in assumptions.md
D17: a quote is not in the briefA requirement's > Brief: line quotes words the brief does not haveQuote the brief's own sentence, or drop the requirement
D7: an open questionA question no requirement waits forMake the requirement it blocks wait for it, or answer it
draft_agent_failedThe agent command did not run or failedRun the command on its own first; or paste the prompt into your agent
Studio: an answer said "Saved" and nothing changed (0.27 and earlier)questions.md had no Answer columnUpgrade to 0.28.1, or add Answer and Status columns to the table
Studio: Approve the draft never enablesA question is open, or answered while its requirement still waits0.28.1 lists each blocker with its action; on 0.27, remove status="Needs Clarification" and write the answer into the requirement
draft_agent_needs_git--agent works only in a git repositorygit init, or paste the prompt into your agent
"Undone — the agent wrote outside the draft"The agent changed files outside the changeNothing to do: Specgate reverted them
draft_brief_text_lost, draft_brief_body_changedThe agent changed the brief's own textNothing to do: Specgate restored it; try again, or write it yourself

Tickets#

Ticket problems, from a scoped Jira token to a ticket that never moves on the board, are in the table of From a Jira ticket: T1–T9, ticket_epic, ticket_changed, ticket_copy_edited, ticket_key_missing, ticket_bad_key, ticket_no_capability and the specgate alm pr errors (pr_failed). The T-rules are the ticket's Definition of Ready.

change_overlap means two open changes rewrite the same requirement: one in your branch, the other on the same branch or on another branch that is not merged yet (check reads every local and remote-tracking branch). Merged as they are, the second rewrite would replace the first, with or without a git conflict. Agree which goes first, merge it, bring it into the other branch, and draft the second change again over the requirement as merged. Run git fetch first, so the remote branches you compare against are current.

change_id_clash means two open changes on different branches add a requirement with the same id: both were opened before either clone had fetched the other's branch. propose --from-ticket fetches origin before it reserves ids, so this needs two tickets opened within seconds of each other. Renumber the one whose branch is not merged yet, in its delta and in the tests that name it.

change_base_moved means a requirement your change modifies or removes has changed since your delta was written: usually the other ticket of a change_overlap merged first. Archiving your delta as it is would replace the requirement with your rewrite of the old text, and the other ticket's rule would be lost without a conflict, so archive refuses. Bring the base into your branch, rewrite the requirement in your delta over the text as it reads now, keeping what the other change added, then run specgate change validate <change> --rebased to record the new text. The first check or change validate that sees a change records what it rewrites, in based_on in its change.yaml.

A git conflict in docs/specs/capabilities/<name>/spec.md with markers around whole requirements means both branches rewrote that requirement. Write it as it should read with both changes, delete the markers and run specgate check. If the conflict covers the whole file instead, this clone has not registered the merge driver: specgate doctor says so, and specgate harness init registers it.

alm_config_unread_key means a key in alm.config.yaml that your provider does not read. The message names the provider that would; see every key.

Harness#

The harness (specgate harness run) builds requirements with an agent, unattended, one git worktree per requirement. See The harness.

Code or symptomCauseFix
requirement_scenario_unrunnableThe requirement's scenario cannot run yetWrite its feature file and steps first
The attempt ended at write-scopeThe agent edited the specification it is judged againstNothing to do: the attempt is refused; fix the prompt if it repeats
The attempt ended at no-opThe agent wrote no fileCheck the agent's write permissions and its command
agent_rewrote_gate_commandThe agent changed the script your test command runsRefused; the gate command is part of the contract
The first attempt is spent installing dependenciesA new worktree has no node_modulesLeave the default --setup-cmd, or set your install command
A harness/REQ-… branch already existsAn earlier run--resume to continue it, or --force to start over
quality check: <name> failedA quality check found something newRead its findings; take the baseline if it is old debt
Docker is not running hereA quality check runs in Docker, or the tests use Testcontainers; harness run and the studio's Build stop before any agentStart Docker Desktop, or the daemon
the tests need Docker, which they could not reachDocker stopped while the tests ranStart Docker Desktop and run it again: the agent is not asked
The studio's Build says files are uncommittedWork in progress outside the specificationCommit or stash it; the studio commits only the specification
The studio says the folder holds filesIts new-project step only uses an empty folderspecgate init adopts the folder, keeping its files

When another attempt cannot help#

The harness stops at the first failure no retry can fix: the agent out of quota or rate-limited; a gate failing only on files the agent may not edit (a person fixes the specification; "Nothing proves" is still retried, because a test fixes it); a requirement waiting for an answer. At the --timeout (1200 seconds by default) the agent and everything it started are stopped. specgate harness init puts the build in the gate when there is one: passing tests with a broken build do not count as delivered.

CI#

SymptomCauseFix
A pull request was merged while the gate was redThe CI job is not a required checkProtect the base branch: require the check
CI changed behaviour after a Specgate releaseIt should not: specgate ci init pins the versionAfter upgrading the package, run specgate ci init --force to move the pin
CI "runs no tests"No test command is configured yetspecgate config set test_cmd "<command>" — the gate reads it, no change to the CI file
matrix_stale only in CIThe regenerated matrix was not committedRun specgate check locally and commit traceability.md

Agents#

SymptomCauseFix
The agent does not know the /specgate:* commandsThey were not installed for that toolspecgate agents init --tool <name>
agents init left a file as it wasExisting files are never overwrittenspecgate agents init --force, after checking what you would lose
The agent stops: "the stack is TBD and I may not choose it"adopt found no build manifest, so AGENTS.md leaves the stack undecidedspecgate config set stack "<yours>" and config set testing "<yours>"; for a new application, specgate init --forja
The agent edits the spec or a test to get to greenIt treats the contract as codePoint it at AGENTS.md; the harness refuses such an attempt anyway
Studio Build: "The assistant is not configured"No agent in harness.config.yamlChoose one in Build (0.28.1), or specgate config set agent "claude -p < {prompt_file}"
The agent cannot read the prompt on WindowsA temp folder with a space (0.27)0.28.1 quotes such a path; or set TEMP to a folder without spaces

See Agents and Choosing and wiring your agent.

Domain packs#

SymptomCauseFix
expand leaves {{VARS}} in generated filesA required --var was not passedRun it again with the variable; see variables.required in pack.yaml
pack lint rejects a pack that worked beforeA newer schema requires more fieldsRead the error from the latest version: npx @rsaglobaltech/specgate@latest pack lint …

See Domain packs.

Still stuck#

Open an issue with the output of specgate doctor, the failing command, its full output and your Specgate version (specgate --version).

Next#