jamiepine/voicebox · error · ValueError

Invalid manifest.json: missing generation data

Error message

Invalid manifest.json: missing generation data

What it means

Raised during generation import when manifest.json has a 'version' but no 'generation' key (export_import.py:369-370). The 'generation' object carries text/language/duration — without it the importer has nothing to reconstruct. Most commonly hit when uploading a profile-export ZIP (which uses a 'profile' key) into the generation-import endpoint.

Source

Thrown at backend/services/export_import.py:370

    
    zip_buffer = io.BytesIO(file_bytes)
    
    try:
        with zipfile.ZipFile(zip_buffer, 'r') as zip_file:
            # Validate ZIP structure
            namelist = zip_file.namelist()
            
            if "manifest.json" not in namelist:
                raise ValueError("ZIP archive missing manifest.json")
            
            # Read manifest
            manifest_data = json.loads(zip_file.read("manifest.json"))
            
            if "version" not in manifest_data:
                raise ValueError("Invalid manifest.json: missing version")
            
            if "generation" not in manifest_data:
                raise ValueError("Invalid manifest.json: missing generation data")
            
            generation_data = manifest_data["generation"]
            profile_data = manifest_data.get("profile", {})
            
            # Validate required fields
            required_fields = ["text", "language", "duration"]
            for field in required_fields:
                if field not in generation_data:
                    raise ValueError(f"Invalid manifest.json: missing generation.{field}")
            
            # Find audio file in archive
            audio_files = [f for f in namelist if f.startswith("audio/") and f.endswith(".wav")]
            if not audio_files:
                raise ValueError("No audio file found in ZIP archive")
            
            audio_file_path = audio_files[0]
            
            # Check if we should match an existing profile or create metadata

View on GitHub (pinned to 51f49dea19)

Solutions

  1. Confirm you are using the generation import endpoint with a generation archive, not a profile archive.
  2. Open manifest.json and ensure a top-level 'generation' object exists alongside 'version'.
  3. Re-export the generation from a matching-version source instance.
  4. If building the archive programmatically, copy the manifest shape from export_generation_to_zip exactly.

Example fix

// before: profile-shaped manifest sent to generation import
{"version":1, "profile":{"name":"x"}}
// after: generation-shaped manifest
{"version":1, "generation":{"text":"...","language":"en","duration":2.5}, "profile":{"name":"x"}}
Defensive patterns

Strategy: type-guard

Validate before calling

import json, zipfile, io

def manifest_shape_ok(file_bytes: bytes) -> bool:
    with zipfile.ZipFile(io.BytesIO(file_bytes)) as z:
        m = json.loads(z.read('manifest.json'))
    return isinstance(m, dict) and 'version' in m and isinstance(m.get('generation'), dict)

Type guard

def is_generation_manifest(obj: object) -> bool:
    return (
        isinstance(obj, dict)
        and 'version' in obj
        and isinstance(obj.get('generation'), dict)
        and isinstance(obj.get('generation', {}).get('text'), str)
    )

Try / catch

try:
    result = await import_generation_from_bytes(file_bytes, db)
except ValueError as e:
    if 'missing generation data' in str(e):
        raise HTTPException(400, 'This archive has no generation block — is it a profile export?')
    raise HTTPException(400, str(e))

Prevention

When it happens

Trigger: Uploading a profile archive into the generation import flow (profile manifests key on 'profile', not 'generation'); a hand-built manifest that only included the profile block; an exporter bug that wrote version but omitted the generation block.

Common situations: Wrong endpoint for the file type; cross-flow confusion between profile and generation archives; schema drift between exporter and importer versions.

Related errors


AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12). Data as JSON: /api/errors/6dd8fb15d94f654f. Report an issue: GitHub.