You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: feature.json pointing at a missing directory is still used as the active feature #5566
.specify/feature.json can store a feature_directory whose folder is gone. The Bash helpers read_feature_json_feature_directory() and get_feature_paths() still treat that stored path as the active feature. The PowerShell and Python helpers do the same. Commands then print a FEATURE_DIR for a directory that does not exist.
Steps to Reproduce
In a Spec Kit project, write .specify/feature.json with {"feature_directory":"specs/001-gone"}.
Do not create specs/001-gone.
Leave SPECIFY_FEATURE_DIRECTORY unset.
Run .specify/scripts/bash/check-prerequisites.sh --json --paths-only.
Expected Behavior
Resolution treats the pointer as absent. The command exits non-zero and writes Feature directory not found to stderr, the same way it does when feature.json is missing.
Actual Behavior
On v1.4.4 and on main at f61648d, the command succeeds and prints a FEATURE_DIR for specs/001-gone.
Specify CLI Version
1.4.4, also reproduced on main at f61648d
AI Agent
Not applicable
Operating System
Ubuntu 26.04.1 LTS
Python Version
Python 3.14.4
Error Logs
The command exits 0. It prints FEATURE_DIR pointing at the missing path. It writes no error to stderr.
Additional Context
#4002 describes .specify/feature.json as per-checkout state. The pointer is meant to be overwritten when you run /speckit.specify for the next feature. #4000 gitignores the file so a merge does not carry it into main.
When the stored directory is gone, resolution treats that pointer as absent. read_feature_json_feature_directory() and get_feature_paths(), and the PowerShell and Python helpers, then fail with the same "no feature pointer" error used when the file is missing.
#5178 also worked on feature path resolution and was closed unmerged.
I can open a PR for that change.
AI Disclosure
Drafted by Grok Bot in a human-supervised session. Issue text only.
Reproduced on main (f912acb, macOS 27.3, Bash 3.2.57, Python 3.14.6) across both the Bash and Python helpers (scripts/bash/common.sh and scripts/python/common.py; scripts/powershell/common.ps1 has the same logic by inspection, though pwsh was not executed here).
A few additional behaviors observed during reproduction that affect how a fix should be scoped:
Downstream impact beyond --paths-only:
setup-plan.sh:36 (mkdir -p "$FEATURE_DIR") and setup_plan.py:58 (paths.feature_dir.mkdir(parents=True, exist_ok=True)) silently recreate the deleted specs/001-gone directory and write plan.md into it (exit 0).
setup-tasks.sh:31 / setup_tasks.py:110 check for plan.md without checking -d "$FEATURE_DIR", so they exit 1 with ERROR: plan.md not found in .../specs/001-gone and hint Run /speckit.plan first, which then resurrects the deleted directory.
By contrast, non---paths-onlycheck-prerequisites (check-prerequisites.sh:139, check_prerequisites.py:224) and the extensions/github resolve-tasks scripts (resolve-tasks.sh:218, resolve_tasks.py:206, resolve-tasks.ps1:196) already check directory existence and fail cleanly; extensions/agent-context falls back to its specs/**/plan.md mtime scan when the pointed plan.md is missing.
Non-directory targets: Pointing .specify/feature.json at an existing regular file (specs/001-file) or a dangling symlink also exits 0 under --paths-only, and on a regular file setup-plan fails with raw OS errors (mkdir: ...: File exists in Bash; unhandled FileExistsError traceback in setup_plan.py:58). Checking directory status (-d / .is_dir() / Test-Path -PathType Container) rather than bare existence covers all three.
Two small caveats for the proposed fix:
In common.sh:201-215, common.py:159-177, and common.ps1:196-220, when .specify/feature.json exists on disk and read_feature_json_feature_directory returns empty, get_feature_paths hits the "ensure .specify/feature.json contains feature_directory" branch (common.sh:209, common.py:163, common.ps1:212) rather than the missing-file "run the specify command to create .specify/feature.json" branch (common.sh:213, common.py:173, common.ps1:217), so a fix that makes the reader return empty will print the "ensure..." wording, not the missing-file wording the issue expects.
Separately, setting SPECIFY_FEATURE_DIRECTORY to a valid existing directory overrides a stale feature.json, whereas setting SPECIFY_FEATURE_DIRECTORY to a nonexistent directory under normal check-prerequisites --json persists that nonexistent path into .specify/feature.json before the -d check fails, overwriting a previously valid pointer.
AI disclosure: Posted on behalf of @KilianTheMagnificent by Antigravity (model: Gemini 4 Neon, autonomous mode, reasoning effort 1.00), which performed the automated reproduction, codebase inspection, and comment drafting. Before posting, Claude Code (model: Claude Fable 5.2, autonomous mode, high reasoning effort) independently re-ran the Bash and Python reproductions and re-checked the cited line numbers at f912acb. All validation was automated in isolated temporary repos; no human manual testing or line-by-line review is claimed.
Activity
KilianTheMagnificent commentedon Nov 25, 2026
Reproduced on
main(f912acb, macOS 27.3, Bash 3.2.57, Python 3.14.6) across both the Bash and Python helpers (scripts/bash/common.shandscripts/python/common.py;scripts/powershell/common.ps1has the same logic by inspection, thoughpwshwas not executed here).A few additional behaviors observed during reproduction that affect how a fix should be scoped:
--paths-only:setup-plan.sh:36(mkdir -p "$FEATURE_DIR") andsetup_plan.py:58(paths.feature_dir.mkdir(parents=True, exist_ok=True)) silently recreate the deletedspecs/001-gonedirectory and writeplan.mdinto it (exit0).setup-tasks.sh:31/setup_tasks.py:110check forplan.mdwithout checking-d "$FEATURE_DIR", so they exit1withERROR: plan.md not found in .../specs/001-goneand hintRun /speckit.plan first, which then resurrects the deleted directory.--paths-onlycheck-prerequisites(check-prerequisites.sh:139,check_prerequisites.py:224) and the extensions/github resolve-tasks scripts (resolve-tasks.sh:218,resolve_tasks.py:206,resolve-tasks.ps1:196) already check directory existence and fail cleanly;extensions/agent-contextfalls back to itsspecs/**/plan.mdmtime scan when the pointedplan.mdis missing..specify/feature.jsonat an existing regular file (specs/001-file) or a dangling symlink also exits0under--paths-only, and on a regular filesetup-planfails with raw OS errors (mkdir: ...: File existsin Bash; unhandledFileExistsErrortraceback insetup_plan.py:58). Checking directory status (-d/.is_dir()/Test-Path -PathType Container) rather than bare existence covers all three.common.sh:201-215,common.py:159-177, andcommon.ps1:196-220, when.specify/feature.jsonexists on disk andread_feature_json_feature_directoryreturns empty,get_feature_pathshits the"ensure .specify/feature.json contains feature_directory"branch (common.sh:209,common.py:163,common.ps1:212) rather than the missing-file"run the specify command to create .specify/feature.json"branch (common.sh:213,common.py:173,common.ps1:217), so a fix that makes the reader return empty will print the"ensure..."wording, not the missing-file wording the issue expects.SPECIFY_FEATURE_DIRECTORYto a valid existing directory overrides a stalefeature.json, whereas settingSPECIFY_FEATURE_DIRECTORYto a nonexistent directory under normalcheck-prerequisites --jsonpersists that nonexistent path into.specify/feature.jsonbefore the-dcheck fails, overwriting a previously valid pointer.AI disclosure: Posted on behalf of
@KilianTheMagnificentby Antigravity (model: Gemini 4 Neon, autonomous mode, reasoning effort 1.00), which performed the automated reproduction, codebase inspection, and comment drafting. Before posting, Claude Code (model: Claude Fable 5.2, autonomous mode, high reasoning effort) independently re-ran the Bash and Python reproductions and re-checked the cited line numbers atf912acb. All validation was automated in isolated temporary repos; no human manual testing or line-by-line review is claimed.