{"record":{"id":"57df678c9e2c6caf","repo":"github/spec-kit","slug":"error-unknown-option-arg-use-help-for-usag","errorCode":null,"errorMessage":"ERROR: Unknown option '{arg}'. Use --help for usage information.","messagePattern":"ERROR: Unknown option '(.+?)'\\. Use --help for usage information\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"scripts/python/check_prerequisites.py","lineNumber":103,"sourceCode":"            paths_only = True\n        elif arg == \"--template\":\n            index += 1\n            if index >= len(argv):\n                print(\n                    \"ERROR: --template requires a template name\",\n                    file=sys.stderr,\n                )\n                raise SystemExit(1)\n            template_name = argv[index]\n        elif arg in {\"--help\", \"-h\"}:\n            sys.stdout.write(HELP_TEXT)\n            raise SystemExit(0)\n        else:\n            print(\n                f\"ERROR: Unknown option '{arg}'. Use --help for usage information.\",\n                file=sys.stderr,\n            )\n            raise SystemExit(1)\n        index += 1\n\n    return Args(\n        json_mode=json_mode,\n        require_tasks=require_tasks,\n        include_tasks=include_tasks,\n        paths_only=paths_only,\n        template_name=template_name,\n    )\n\n\ndef _dir_has_entries(path: Path) -> bool:\n    try:\n        return path.is_dir() and any(path.iterdir())\n    except OSError:\n        return False\n\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/scripts/python/check_prerequisites.py#L85-L121","documentation":"In _validate_safe_shared_directory(), an existing component on the path is not a directory (typically a regular file), so validation fails even though this validator tolerates missing paths. The message hardcodes 'Shared infrastructure directory' because this validator only serves shared-infra directory checks.","triggerScenarios":"A file occupies a component of the shared-infra directory path: e.g. a file named 'shared' at .specify/shared, or .specify itself is a file, while the CLI validates a destination under it.","commonSituations":"Marker files or accidental buffers named like directories ('.specify' created by touch); scripts writing state files at directory paths; partial checkouts; conflicting file/dir names between workflow versions (a file in an old layout where a directory is expected after upgrade).","solutions":["Inspect the named path from the error label; if it is not needed, delete it","If it may hold data, move it aside (mv X X.bak) and rerun so a real directory can be created","Search for the tool/script that created the file and fix it","Pre-flight check in automation: assert not (p.exists() and not p.is_dir()) for each parent"],"exampleFix":"# before\nPath('.specify/shared').is_file()  # True -> raises during validate\n\n# after\n$ mv .specify/shared .specify/shared.bak\n# rerun command; directory structure recreated","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef validate_no_collisions(project: Path, rel_dir: Path) -> None:\n    cur = project\n    for part in rel_dir.parts:\n        cur = cur / part\n        if cur.exists() and not cur.is_dir():\n            raise RuntimeError(f'file blocks directory: {cur}')\n\nvalidate_no_collisions(project_path, rel_dir)","typeGuard":null,"tryCatchPattern":"try:\n    _validate_safe_shared_directory(project_path, directory)\nexcept ValueError as e:\n    if 'is not a directory' in str(e):\n        blocker = extract_path_from_message(e)\n        blocker.rename(blocker.with_suffix('.bak'))\n        _validate_safe_shared_directory(project_path, directory)\n    else:\n        raise","preventionTips":["Don't create files at directory paths in .specify","Watch for editor plugins/scripts saving buffers named like directories","Reset .specify wholly after layout-changing upgrades"],"tags":["filesystem","directory","validation"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}