{"record":{"id":"c08c4df27464feb4","repo":"github/spec-kit","slug":"invalid-template-field-expected-a-string-got","errorCode":null,"errorMessage":"Invalid template {field}: expected a string, got {type(tmpl[field]).__name__}","messagePattern":"Invalid template (.+?): expected a string, got (.+?)","errorType":"validation","errorClass":"PresetValidationError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/presets/__init__.py","lineNumber":430,"sourceCode":"        for tmpl in templates:\n            if not isinstance(tmpl, dict):\n                raise PresetValidationError(\n                    \"Each template entry in 'provides.templates' must be a mapping\"\n                )\n            if \"type\" not in tmpl or \"name\" not in tmpl or \"file\" not in tmpl:\n                raise PresetValidationError(\n                    \"Template missing 'type', 'name', or 'file'\"\n                )\n\n            # 'name' feeds re.match and 'file' feeds os.path.normpath below;\n            # both raise a bare TypeError on a non-string, which is not a\n            # PresetValidationError and so escapes the callers that handle a\n            # malformed manifest. The sibling extension manifest already\n            # rejects a non-string command 'file' via\n            # relative_extension_path_violation().\n            for field in (\"type\", \"name\", \"file\"):\n                if not isinstance(tmpl[field], str):\n                    raise PresetValidationError(\n                        f\"Invalid template {field}: expected a string, \"\n                        f\"got {type(tmpl[field]).__name__}\"\n                    )\n\n            if tmpl[\"type\"] not in VALID_PRESET_TEMPLATE_TYPES:\n                raise PresetValidationError(\n                    f\"Invalid template type '{tmpl['type']}': \"\n                    f\"must be one of {sorted(VALID_PRESET_TEMPLATE_TYPES)}\"\n                )\n\n            # Validate file path safety: must be relative, no parent traversal\n            file_path = tmpl[\"file\"]\n            normalized = os.path.normpath(file_path)\n            if os.path.isabs(normalized) or normalized.startswith(\"..\"):\n                raise PresetValidationError(\n                    f\"Invalid template file path '{file_path}': \"\n                    \"must be a relative path within the preset directory\"\n                )","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/presets/__init__.py#L412-L448","documentation":"Error \"Invalid template {field}: expected a string, got {type(tmpl[field]).__name__}\" thrown in github/spec-kit.","triggerScenarios":"Thrown at src/specify_cli/presets/__init__.py:430 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the template type/name/file value a string."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c","analyzedAt":"2026-08-14T19:43:37.150Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}