windmill-labs/windmill · error

invalid raw app bundle: ${e?.message ?? String(e)}

Error message

invalid raw app bundle: ${e?.message ?? String(e)}

What it means

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.

Source

Thrown at frontend/src/lib/components/workspaceSettings/projectInstall.ts:167

	if (await VariableService.existsVariable({ workspace, path })) return
	await VariableService.createVariable({
		workspace,
		requestBody: {
			path,
			value: '',
			is_secret: true,
			description: 'Imported placeholder — fill in the value.'
		}
	})
}

async function importApp(workspace: string, a: ExportItem): Promise<unknown> {
	if (a.app_type === 'raw') {
		let parsed: any
		try {
			parsed = JSON.parse(a.value?.raw ?? '{}')
		} catch (e: any) {
			throw new Error(`invalid raw app bundle: ${e?.message ?? String(e)}`)
		}
		const files = { ...(parsed.files ?? {}) }
		const js = files['/bundle.js'] ?? ''
		const css = files['/bundle.css'] ?? ''
		delete files['/bundle.js']
		delete files['/bundle.css']
		const runnables = parsed.runnables ?? {}
		return AppService.createAppRaw({
			workspace,
			formData: {
				app: {
					path: a.path,
					summary: a.summary ?? '',
					value: {
						files,
						runnables,
						// Keep the full-code app's explicit data table declaration.
						...(parsed.data !== undefined ? { data: parsed.data } : {}),

View on GitHub (pinned to e474e8803c)

Solutions

  1. Open the project export file and JSON-validate the `value.raw` string of the failing app item (it must itself be a JSON document).
  2. Re-export the project from the source workspace instead of hand-editing the export.
  3. Check Windmill versions between source and target workspaces for raw app export format changes and upgrade the target.
  4. If the value is missing (`undefined`), fix the export generation so raw apps include their `value.raw` bundle.

Example fix

// before (corrupted export)
"value": { "raw": "{ app: { ... } }" }   // invalid JSON
// after
"value": { "raw": "{\"app\":{...},\"files\":{...}}" } // valid JSON string
Defensive patterns

Strategy: validation

Validate before calling

const raw = a.value?.raw
if (typeof raw !== 'string') throw new Error('raw app item missing value.raw')
try { JSON.parse(raw) } catch (e) { throw new Error(`export item '${a.path}' has invalid raw app JSON`) }

Type guard

function hasRawBundle(a: any): a is { app_type: 'raw'; value: { raw: string } } {
  return !!a && a.app_type === 'raw' && typeof a.value?.raw === 'string'
}

Try / catch

try {
  await installProject(export)
} catch (e) {
  if (String(e.message).startsWith('invalid raw app bundle')) {
    // surface which app item failed and re-export it
  }
  throw e
}

Prevention

When it happens

Trigger: 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).

Common situations: 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]`).

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/79b854cf1e012874. Report an issue: GitHub.