{"record":{"id":"79b854cf1e012874","repo":"windmill-labs/windmill","slug":"invalid-raw-app-bundle-e-message-string-e","errorCode":null,"errorMessage":"invalid raw app bundle: ${e?.message ?? String(e)}","messagePattern":"invalid raw app bundle: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/workspaceSettings/projectInstall.ts","lineNumber":167,"sourceCode":"\tif (await VariableService.existsVariable({ workspace, path })) return\n\tawait VariableService.createVariable({\n\t\tworkspace,\n\t\trequestBody: {\n\t\t\tpath,\n\t\t\tvalue: '',\n\t\t\tis_secret: true,\n\t\t\tdescription: 'Imported placeholder — fill in the value.'\n\t\t}\n\t})\n}\n\nasync function importApp(workspace: string, a: ExportItem): Promise<unknown> {\n\tif (a.app_type === 'raw') {\n\t\tlet parsed: any\n\t\ttry {\n\t\t\tparsed = JSON.parse(a.value?.raw ?? '{}')\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`invalid raw app bundle: ${e?.message ?? String(e)}`)\n\t\t}\n\t\tconst files = { ...(parsed.files ?? {}) }\n\t\tconst js = files['/bundle.js'] ?? ''\n\t\tconst css = files['/bundle.css'] ?? ''\n\t\tdelete files['/bundle.js']\n\t\tdelete files['/bundle.css']\n\t\tconst runnables = parsed.runnables ?? {}\n\t\treturn AppService.createAppRaw({\n\t\t\tworkspace,\n\t\t\tformData: {\n\t\t\t\tapp: {\n\t\t\t\t\tpath: a.path,\n\t\t\t\t\tsummary: a.summary ?? '',\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tfiles,\n\t\t\t\t\t\trunnables,\n\t\t\t\t\t\t// Keep the full-code app's explicit data table declaration.\n\t\t\t\t\t\t...(parsed.data !== undefined ? { data: parsed.data } : {}),","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/workspaceSettings/projectInstall.ts#L149-L185","documentation":"importApp imports an exported Windmill app item. When the app is a raw app, it JSON-parses the item's `value.raw` string; if JSON.parse throws (malformed or non-JSON bundle), it rethrows as `invalid raw app bundle: <message>`. This means the app export payload stored in the project export is not valid JSON, so the raw app cannot be reconstructed during project install.","triggerScenarios":"Calling installProject/importApp with an ExportItem whose app_type is 'raw' and whose `value.raw` is not valid JSON (e.g. `undefined`/`null` coerced, hand-edited export, truncated file, double-encoded JSON, or a `{}` fallback masking an earlier failure producing garbage).","commonSituations":"Hand-editing or partial-copying a project export JSON; exporting from an older Windmill version whose raw app value shape differs; a corrupted upload/download of the export file; programmatically generating exports where the raw app value was stringified incorrectly (e.g. `[object Object]`).","solutions":["Open the project export file and JSON-validate the `value.raw` string of the failing app item (it must itself be a JSON document).","Re-export the project from the source workspace instead of hand-editing the export.","Check Windmill versions between source and target workspaces for raw app export format changes and upgrade the target.","If the value is missing (`undefined`), fix the export generation so raw apps include their `value.raw` bundle."],"exampleFix":"// before (corrupted export)\n\"value\": { \"raw\": \"{ app: { ... } }\" }   // invalid JSON\n// after\n\"value\": { \"raw\": \"{\\\"app\\\":{...},\\\"files\\\":{...}}\" } // valid JSON string","handlingStrategy":"validation","validationCode":"const raw = a.value?.raw\nif (typeof raw !== 'string') throw new Error('raw app item missing value.raw')\ntry { JSON.parse(raw) } catch (e) { throw new Error(`export item '${a.path}' has invalid raw app JSON`) }","typeGuard":"function hasRawBundle(a: any): a is { app_type: 'raw'; value: { raw: string } } {\n  return !!a && a.app_type === 'raw' && typeof a.value?.raw === 'string'\n}","tryCatchPattern":"try {\n  await installProject(export)\n} catch (e) {\n  if (String(e.message).startsWith('invalid raw app bundle')) {\n    // surface which app item failed and re-export it\n  }\n  throw e\n}","preventionTips":["Never hand-edit export files; always export via the UI/CLI.","Validate the export file with a JSON schema/linter before installing.","Keep source and target Windmill versions compatible."],"tags":["json-parse","import","raw-app"],"backgroundTag":"invalid-json-payload","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}