{"record":{"id":"e2a78075ab531cc6","repo":"zylon-ai/private-gpt","slug":"mime-type-unknown","errorCode":"MIME_TYPE_UNKNOWN","errorMessage":"Could not determine MIME type for file: {value.path}","messagePattern":"Could not determine MIME type for file: (.+?)","errorType":"error_code","errorClass":"SkillDomainError","httpStatus":null,"severity":"error","filePath":"private_gpt/server/skills/skills_files.py","lineNumber":92,"sourceCode":"            resolved = {\n                \"SKILL.md\": StoredFile(\n                    path=\"SKILL.md\",\n                    content=stored.content,\n                    mime_type=\"text/markdown\",\n                )\n            }\n\n    for value in resolved.values():\n        if not value.mime_type:\n            mime_type, _ = (\n                (\"text/markdown\", None)\n                if value.path.endswith(\".md\")\n                else mimetypes.guess_type(value.path)\n            )\n            value.mime_type = mime_type or default_mime_type\n\n        if not value.mime_type:\n            raise SkillDomainError(\n                SkillErrorCode.MIME_TYPE_UNKNOWN,\n                f\"Could not determine MIME type for file: {value.path}\",\n            )\n\n    if \"SKILL.md\" not in resolved:\n        raise SkillDomainError(\n            SkillErrorCode.MISSING_SKILL_MD, \"Upload must include a SKILL.md file.\"\n        )\n\n    return list(resolved.values())\n\n\ndef _normalize_path(path: str) -> str:\n    # Normalize backslashes to forward slashes\n    path = path.replace(\"\\\\\", \"/\")\n\n    parsed = PurePosixPath(path)\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/server/skills/skills_files.py#L74-L110","documentation":"SkillDomainError with code MIME_TYPE_UNKNOWN: after resolving uploaded files, any file whose mime_type is still falsy raises this. mime_type is set from the '.md' shortcut, mimetypes.guess_type, or the default_mime_type parameter — so it only fires when default_mime_type was explicitly passed as None and the extension is unrecognized.","triggerScenarios":"Calling stored_files_from_uploads(uploads, default_mime_type=None) (or None default propagation) with a file whose path has an extension mimetypes cannot map (e.g. '.tmp', '.dat', no extension) — note this specific error can only trigger when the caller disabled the octet-stream fallback.","commonSituations":"Callers passing None to enforce strict mime detection on user uploads; extension-less files extracted from zips; exotic or custom extensions not in the system mime table; differing mimetypes registries across OS images making CI behave differently than dev.","solutions":["Pass default_mime_type='application/octet-stream' (the documented default) so unknown extensions fall back instead of erroring.","Rename the offending file to a known extension before upload.","Register the custom extension with mimetypes (mimetypes.add_type) if it is a format your deployment genuinely supports.","Inspect the resolved file list to find which path has no mime_type and fix that entry."],"exampleFix":"# before\nfiles = await stored_files_from_uploads(uploads, default_mime_type=None)\n# after\nfiles = await stored_files_from_uploads(uploads)  # default fallback 'application/octet-stream'","handlingStrategy":"validation","validationCode":"import mimetypes\nKNOWN = {'.md', '.txt', '.py', '.json', '.pdf', '.png', '.yaml'}\nunknown = [p for p in paths if mimetypes.guess_type(p)[0] is None and not p.endswith('.md') and Path(p).suffix not in KNOWN]\nassert not unknown, f'unrecognized extensions: {unknown}'","typeGuard":"const hasKnownExtension = (path: string): boolean =>\n  /\\.(md|txt|py|json|pdf|png|ya?ml)$/i.test(path);","tryCatchPattern":"try:\n    files = await stored_files_from_uploads(uploads, default_mime_type=None)\nexcept SkillDomainError as e:\n    if e.code == SkillErrorCode.MIME_TYPE_UNKNOWN:\n        files = await stored_files_from_uploads(uploads)  # retry with octet-stream fallback\n    else:\n        raise","preventionTips":["Default to the octet-stream fallback unless strict mime enforcement is a requirement.","Standardize uploaded artifacts on well-known extensions.","Pre-scan zip members for extension-less entries before upload."],"tags":["mime-type","upload","skills","domain-error","validation"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}