{"record":{"id":"5c7f25a63e53ab29","repo":"github/spec-kit","slug":"hook-hook-name-missing-required-command-fiel","errorCode":null,"errorMessage":"Hook '{hook_name}' missing required 'command' field","messagePattern":"Hook '(.+?)' missing required 'command' field","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/extensions/__init__.py","lineNumber":425,"sourceCode":"        self._validate_provided_artifacts(templates, section=\"templates\", singular=\"template\")\n        self._validate_provided_artifacts(scripts, section=\"scripts\", singular=\"script\")\n\n        # Validate hook values (if present).\n        # Each event is a single mapping or a list of mappings.\n        if hooks:\n            for hook_name, hook_config in hooks.items():\n                if isinstance(hook_config, list) and not hook_config:\n                    raise ValidationError(\n                        f\"Invalid hook '{hook_name}': list must contain at least one entry\"\n                    )\n                for entry in coerce_hook_entries(hook_config):\n                    if not isinstance(entry, dict):\n                        raise ValidationError(\n                            f\"Invalid hook '{hook_name}': \"\n                            \"expected a mapping or list of mappings\"\n                        )\n                    if not entry.get(\"command\"):\n                        raise ValidationError(\n                            f\"Hook '{hook_name}' missing required 'command' field\"\n                        )\n                    if \"priority\" in entry:\n                        priority = entry[\"priority\"]\n                        if not isinstance(priority, int) or isinstance(priority, bool):\n                            raise ValidationError(\n                                f\"Hook '{hook_name}' has invalid 'priority': \"\n                                \"must be an integer\"\n                            )\n                        if priority < 1:\n                            raise ValidationError(\n                                f\"Hook '{hook_name}' has invalid 'priority': \"\n                                \"must be >= 1\"\n                            )\n\n        # Validate commands; track renames so hook references can be rewritten.\n        rename_map: Dict[str, str] = {}\n        for cmd in commands:","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/extensions/__init__.py#L407-L443","documentation":"Every hook entry mapping must contain a truthy command field — the executable string the hook dispatcher runs. Missing, empty, or null command values are rejected.","triggerScenarios":"A hook entry `{handler: setup}` (no command), `{command: \"\"}`, or `{command: null}`. entry.get(\"command\") is falsy and the error names the hook.","commonSituations":"Author names the key `cmd` or `script` instead of `command`, or leaves a placeholder empty while drafting the manifest.","solutions":["Add `command: <executable or script path>` to the hook entry.","Use the exact key name `command` — synonyms like cmd/script/run are not recognized.","Ensure the value is non-empty; an empty string fails."],"exampleFix":"# before\nhooks:\n  post-install:\n    - script: ./setup.sh\n\n# after\nhooks:\n  post-install:\n    - command: ./setup.sh","handlingStrategy":"validation","validationCode":"def hook_commands_present(data: dict) -> bool:\n    hooks = data.get(\"hooks\") or {}\n    for cfg in hooks.values():\n        entries = cfg if isinstance(cfg, list) else [cfg]\n        for e in entries:\n            if not isinstance(e, dict) or not e.get(\"command\"):\n                return False\n    return True","typeGuard":null,"tryCatchPattern":null,"preventionTips":["The key is literally `command` — not cmd, script, or run.","Fill it with a non-empty executable string before installing."],"tags":["extension-manifest","validation","hooks","required-fields"],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}