copy/v86 · warning

Warning: Unknown option 'state'. Did you mean 'initial_state

Error message

Warning: Unknown option 'state'. Did you mean 'initial_state'?

What it means

v86's starter (src/browser/starter.js:469) validates the options object passed to V86/Starter. It warns when options.state is provided, because the correct option name is initial_state — an unknown key like 'state' is silently ignored, so the saved machine state would not be loaded. The warning nudges you to rename the option; emulation otherwise starts normally without the state.

Source

Thrown at src/browser/starter.js:469

        {
            files_to_load.push({
                name: name,
                url: file.url,
                size: file.size,
            });
        }
        else
        {
            files_to_load.push({
                name,
                loadable: buffer_from_object(file, this.zstd_decompress_worker.bind(this)),
            });
        }
    };

    if(options.state)
    {
        console.warn("Warning: Unknown option 'state'. Did you mean 'initial_state'?");
    }

    add_file("bios", options.bios);
    add_file("vga_bios", options.vga_bios);
    add_file("cdrom", options.cdrom);
    add_file("hda", options.hda);
    add_file("hdb", options.hdb);
    add_file("fda", options.fda);
    add_file("fdb", options.fdb);
    add_file("initial_state", options.initial_state);
    add_file("multiboot", options.multiboot);
    add_file("bzimage", options.bzimage);
    add_file("initrd", options.initrd);

    if(options.filesystem && options.filesystem.handle9p)
    {
        settings.handle9p = options.filesystem.handle9p;
    }

View on GitHub (pinned to 180830d539)

Solutions

  1. Rename the option from state to initial_state in the V86 constructor options
  2. Ensure the value passed to initial_state matches the format produced by your save routine (v86state buffer from emulator.save_state())
  3. Check other similarly named options against the documented V86 options to catch related renames (e.g. bzimage/initrd, hda) in the same config object

Example fix

// before
new V86({ wasm_path, screen_container, bios: biosBuffer, state: savedState });
// after
new V86({ wasm_path, screen_container, bios: biosBuffer, initial_state: savedState });
Defensive patterns

Strategy: validation

Validate before calling

function validateV86Options(options)
{
    const known = ['wasm_path','screen_container','bios','vga_bios','cdrom','hda','initial_state','bzimage','initrd','memory_size','autostart'];
    const unknown = Object.keys(options).filter(k => !known.includes(k));
    if(unknown.includes('state'))
        throw new Error("option 'state' is not supported; use 'initial_state'");
    return unknown;
}

Try / catch

try
{
    const emulator = new V86(options);
}
catch(e)
{
    if(String(e).includes('initial_state'))
        console.error('Config error: rename options.state to options.initial_state');
    throw e;
}

Prevention

When it happens

Trigger: Calling new V86({... state: <ArrayBuffer or object> }) instead of initial_state when resuming a saved machine snapshot.

Common situations: Migrating code that used an older/renamed option key; copying config from a blog post or AI answer that used 'state'; a typo while wiring up save/restore of emulator snapshots; APIs (e.g. custom save-state helpers) returning a field literally named 'state'.

Related errors


AI-assisted analysis of copy/v86@180830d539 (2026-08-31). Data as JSON: /api/errors/1b6529d6f9db950d. Report an issue: GitHub.