linshenkx/prompt-optimizer · error · Error
app backup package is missing app-data.json
Error message
app backup package is missing app-data.json
What it means
Thrown by readDataManagerResourcePackage in packages/ui/src/utils/data-manager-resource-package.ts when the zip contains manifest.json but no entry at APP_DATA_JSON_PATH ('app-data.json'). The app data payload is mandatory for restore, so the package is rejected. This check runs after the manifest.json presence check, so the archive is already known to be a plausible backup.
Source
Thrown at packages/ui/src/utils/data-manager-resource-package.ts:293
export const readDataManagerResourcePackage = (
input: ArrayBuffer | Uint8Array,
): {
manifest: DataManagerResourcePackageManifest
appDataJson: string
favoritesJson: string
files: Record<string, Uint8Array>
} => {
const bytes = input instanceof Uint8Array ? input : new Uint8Array(input)
const files = unzipSync(bytes)
const manifestBytes = files['manifest.json']
const appDataBytes = files[APP_DATA_JSON_PATH]
const favoritesBytes = files[FAVORITES_JSON_PATH]
if (!manifestBytes) {
throw new Error('app backup package is missing manifest.json')
}
if (!appDataBytes) {
throw new Error('app backup package is missing app-data.json')
}
if (!favoritesBytes) {
throw new Error('app backup package is missing favorites.json')
}
return {
manifest: parseManifest(strFromU8(manifestBytes)),
appDataJson: strFromU8(appDataBytes),
favoritesJson: strFromU8(favoritesBytes),
files,
}
}
const getImportStorageService = (
store: DataManagerImageStoreKey,
options: ImportDataManagerResourcePackageOptions,
): Pick<IImageStorageService, 'getImage' | 'saveImage'> | null | undefined =>
store === 'favoriteImages'View on GitHub (pinned to 3e677b1d9f)
Solutions
- Verify the zip contains an 'app-data.json' entry at the root alongside manifest.json
- Re-export the backup from the source app rather than repairing a partial package
- If the export was interrupted, discard the file and retry the export to get a complete archive
- Pre-validate entries before calling readDataManagerResourcePackage and surface a file-picker error to the user
Example fix
// before
const pkg = readDataManagerResourcePackage(bytes) // throws: missing app-data.json
// after
const names = Object.keys(unzipSync(bytes))
for (const required of ['manifest.json', 'app-data.json', 'favorites.json']) {
if (!names.includes(required)) throw new Error(`Backup incomplete: no ${required}`)
}
const pkg = readDataManagerResourcePackage(bytes) Defensive patterns
Strategy: validation
Validate before calling
import { unzipSync } from 'fflate'
const REQUIRED = ['manifest.json', 'app-data.json', 'favorites.json'] as const
const hasAllEntries = (bytes: Uint8Array): boolean => {
try {
const entries = Object.keys(unzipSync(bytes))
return REQUIRED.every((name) => entries.includes(name))
} catch {
return false
}
} Try / catch
try {
const pkg = readDataManagerResourcePackage(bytes)
} catch (e) {
if (e instanceof Error && e.message.includes('missing app-data.json')) {
// treat as incomplete/corrupt export; ask user to re-export
return
}
throw e
} Prevention
- Pre-validate all three required entries before restore
- Don't attempt to repair partial packages; re-export instead
- Ensure exports complete atomically (write zip last) so partial files are less common
- Warn users when downloads are interrupted (size/content-type checks)
When it happens
Trigger: A zip with manifest.json present but app-data.json absent: partially generated packages where the app-data write failed, an archive repacked without the payload file, a renamed or moved app-data.json entry, or a manifest-only zip used as a template.
Common situations: Interrupted export (disk full, tab closed) producing a partial zip; manual repackaging that dropped the payload; upload pipeline that filters 'unnecessary' JSON files; filename casing differences introduced by zip tools.
Related errors
- app backup package is missing manifest.json
- app backup package is missing favorites.json
- favorites package is missing favorites.json
- Invalid app backup package manifest
- favorites package is missing manifest.json
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/eb9b6ac44752188e.
Report an issue: GitHub.