{"record":{"id":"3980a91f004eeefc","repo":"Budibase/budibase","slug":"project-package-contains-unsupported-doc-files","errorCode":null,"errorMessage":"Project package contains unsupported doc files.","messagePattern":"Project package contains unsupported doc files\\.","errorType":"validation","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/projects/backups/imports.ts","lineNumber":1004,"sourceCode":"      readJsonFile<ProjectPackageDependencyIndex>(dependencyIndexPath),\n    ])\n\n    validateManifest(manifest)\n    validateProject(project)\n    validateDependencyIndexShape(dependencyIndex)\n\n    const docFiles = await fsp\n      .access(docsPath)\n      .then(() =>\n        packageFiles.filter(filePath => filePath.startsWith(docsPath))\n      )\n      .catch(() => [])\n\n    if (docFiles.length > MAX_PACKAGE_DOCS) {\n      throw new HTTPError(\"Project package contains too many docs.\", 400)\n    }\n    if (docFiles.some(filePath => !filePath.endsWith(\".json\"))) {\n      throw new HTTPError(\n        \"Project package contains unsupported doc files.\",\n        400\n      )\n    }\n\n    const docs = await Promise.all(\n      docFiles\n        .filter(filePath => filePath.endsWith(\".json\"))\n        .map(async filePath => {\n          const doc = await readJsonFile<AnyDocument>(filePath)\n          if (!isRecord(doc) || typeof doc._id !== \"string\") {\n            throw new HTTPError(\n              `Project package contains an invalid doc in '${basename(filePath)}'.`,\n              400\n            )\n          }\n          return {\n            path: filePath,","sourceCodeStart":986,"sourceCodeEnd":1022,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/projects/backups/imports.ts#L986-L1022","documentation":"Thrown by extractProjectPackage when any file inside the Project package's docs directory does not end with .json. Only JSON doc files are permitted there; anything else (text, binaries, archives, CSV) makes the package invalid.","triggerScenarios":"importProject with a package whose docs folder contains non-.json entries — e.g. README.md, .DS_Store, .csv exports, temp files, or subdirectories containing assets added after export.","commonSituations":"Re-zipping an exported package after OS artifacts (.DS_Store, Thumbs.db) slipped into docs/; editors adding backup files (*.json.bak does NOT match the .endsWith('.json') check and will trigger this); manual edits to the archive.","solutions":["Remove all non-.json files from the docs directory in the package and repackage","Re-export the Project from Budibase instead of hand-editing the archive","Check for hidden files (find docs -type f ! -name '*.json') before zipping","Rename files to .json only if their content really is a valid doc; otherwise delete them"],"exampleFix":"// before\ndocs/\n  datasources.json\n  notes.md          <- unsupported\n// after\ndocs/\n  datasources.json","handlingStrategy":"validation","validationCode":"const files = await readdir(\"docs\")\nconst nonJson = files.filter(f => !f.endsWith(\".json\"))\nif (nonJson.length) throw new Error(`Non-JSON files in docs: ${nonJson.join(\", \")}`)","typeGuard":"null","tryCatchPattern":"try {\n  await sdk.projects.importProject(file)\n} catch (e) {\n  if (String(e.message).includes(\"unsupported doc files\")) {\n    // strip non-json entries from the archive and retry\n  }\n}","preventionTips":["Clean hidden OS files (.DS_Store, Thumbs.db) out of docs/ before zipping","Never rename non-JSON data to .json to sneak it through","Validate archive contents (tar -t / unzip -l) before import"],"tags":["validation","import","project-package","http-400"],"backgroundTag":"project-package-validation-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}