{"record":{"id":"d5b3e52609c70ca2","repo":"Budibase/budibase","slug":"project-package-project-json-is-invalid","errorCode":null,"errorMessage":"Project package project.json is invalid.","messagePattern":"Project package project\\.json is invalid\\.","errorType":"validation","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/projects/backups/imports.ts","lineNumber":690,"sourceCode":"    if (\n      !isRecord(unsupported) ||\n      typeof unsupported.type !== \"string\" ||\n      !Number.isInteger(unsupported.count) ||\n      Number(unsupported.count) < 0 ||\n      typeof unsupported.reason !== \"string\"\n    ) {\n      throw new HTTPError(\"Project package manifest is invalid.\", 400)\n    }\n  }\n}\n\nconst validateProject = (project: Project) => {\n  if (\n    !isRecord(project) ||\n    typeof project._id !== \"string\" ||\n    typeof project.name !== \"string\"\n  ) {\n    throw new HTTPError(\"Project package project.json is invalid.\", 400)\n  }\n}\n\nconst validateUsedResource = (value: unknown) => {\n  return (\n    isRecord(value) &&\n    typeof value.id === \"string\" &&\n    typeof value.name === \"string\" &&\n    isAllowedImportType(value.type) &&\n    ALLOWED_IMPORT_TYPES.has(value.type)\n  )\n}\n\nconst validateDependencyIndexShape = (\n  dependencyIndex: ProjectPackageDependencyIndex\n) => {\n  if (\n    !isRecord(dependencyIndex) ||","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/projects/backups/imports.ts#L672-L708","documentation":"After manifest validation, the importer validates the project.json project document itself: it must be a record with string _id and string name. This 400 error means the core project document in the package is missing or malformed, so a workspace cannot be created from it. This usually indicates package corruption or an incompatible export.","triggerScenarios":"The package's project.json lacks the project doc, or its _id/name fields are absent, null, or non-string — e.g. an archive assembled incorrectly, a truncated export, or a doc exported in an unexpected shape.","commonSituations":"Packages unpacked and repacked with files renamed or dropped; exports from incompatible tooling; a project whose document was corrupted before export.","solutions":["Re-export the project package from a healthy workspace.","Inspect project.json inside the archive and ensure the project object has string _id and name fields.","Re-download the export to rule out transfer corruption.","Verify the archive structure matches what Budibase exports (manifest + project.json + resources)."],"exampleFix":"// before: project.json\n{ \"name\": 123 }\n// after\n{ \"_id\": \"workspace_abc123\", \"name\": \"My Project\" }","handlingStrategy":"type-guard","validationCode":"const project = JSON.parse(await readFile(\"project.json\", \"utf8\"))\nif (typeof project !== \"object\" || project === null || typeof project._id !== \"string\" || typeof project.name !== \"string\")\n  throw new Error(\"project.json must contain a project object with string _id and name\")","typeGuard":"const isValidProjectDoc = (p: unknown): p is { _id: string; name: string } =>\n  typeof p === \"object\" && p !== null &&\n  typeof (p as { _id?: unknown })._id === \"string\" &&\n  typeof (p as { name?: unknown }).name === \"string\"","tryCatchPattern":"try {\n  await importProjectPackage(file)\n} catch (err) {\n  if (err instanceof HTTPError && err.status === 400 && err.message.includes(\"project.json is invalid\")) {\n    // inspect project.json in the archive for missing _id/name\n  }\n  throw err\n}","preventionTips":["Verify project.json exists and contains _id and name before import","Avoid renaming or repacking archive files manually","Re-export if the source project document looks damaged"],"tags":["import","project-validation","malformed-package","project-package"],"backgroundTag":"manifest-schema-validation-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}