{"record":{"id":"767c6193d11e646c","repo":"github/spec-kit","slug":"extensionignore-is-not-valid-utf-8-ignore-file","errorCode":null,"errorMessage":".extensionignore is not valid UTF-8: {ignore_file} ({e.reason} at byte {e.start})","messagePattern":"\\.extensionignore is not valid UTF-8: (.+?) \\((.+?) at byte (.+?)\\)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"src/specify_cli/extensions/__init__.py","lineNumber":1251,"sourceCode":"\n        # Pin UTF-8 explicitly: ``Path.read_text`` defaults to the system\n        # locale codec on Windows (cp1252 / gb2312 / cp932), which silently\n        # corrupts multibyte patterns when the file is shared across\n        # machines with different locales. The next line already\n        # normalises backslashes \"so Windows-authored files work\" — the\n        # codebase already expects Windows authors to write this file.\n        #\n        # A file that is not valid UTF-8 is a user-authoring mistake, so\n        # surface it as ``ValidationError`` with a pointer to the offending\n        # byte — the same pattern ``ExtensionManifest._load_yaml`` uses\n        # for ``extension.yml`` (see ``UnicodeDecodeError`` handler in\n        # this module). Without the wrap, the raw ``UnicodeDecodeError``\n        # would abort installation with a Python traceback instead of a\n        # clear message naming the file.\n        try:\n            raw = ignore_file.read_text(encoding=\"utf-8\")\n        except UnicodeDecodeError as e:\n            raise ValidationError(\n                f\".extensionignore is not valid UTF-8: {ignore_file} \"\n                f\"({e.reason} at byte {e.start})\"\n            )\n        lines: List[str] = raw.splitlines()\n\n        # Normalise backslashes in patterns so Windows-authored files work\n        normalised: List[str] = []\n        for line in lines:\n            stripped = line.strip()\n            if stripped and not stripped.startswith(\"#\"):\n                normalised.append(stripped.replace(\"\\\\\", \"/\"))\n            else:\n                # Preserve blanks/comments so pathspec line numbers stay stable\n                normalised.append(line)\n\n        # Always ignore the .extensionignore file itself\n        normalised.append(\".extensionignore\")\n","sourceCodeStart":1233,"sourceCodeEnd":1269,"githubUrl":"https://github.com/github/spec-kit/blob/bf88c9f9a82fa370c7a7257aa2b3cf10b457b65c/src/specify_cli/extensions/__init__.py#L1233-L1269","documentation":"Error \".extensionignore is not valid UTF-8: {ignore_file} ({e.reason} at byte {e.start})\" thrown in github/spec-kit.","triggerScenarios":"Thrown at src/specify_cli/extensions/__init__.py:1251 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-save .extensionignore as UTF-8 text, or remove the invalid bytes at the reported offset."],"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"}