{"record":{"id":"1b6529d6f9db950d","repo":"copy/v86","slug":"warning-unknown-option-state-did-you-mean-ini","errorCode":null,"errorMessage":"Warning: Unknown option 'state'. Did you mean 'initial_state'?","messagePattern":"Warning: Unknown option 'state'\\. Did you mean 'initial_state'\\?","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/browser/starter.js","lineNumber":469,"sourceCode":"        {\n            files_to_load.push({\n                name: name,\n                url: file.url,\n                size: file.size,\n            });\n        }\n        else\n        {\n            files_to_load.push({\n                name,\n                loadable: buffer_from_object(file, this.zstd_decompress_worker.bind(this)),\n            });\n        }\n    };\n\n    if(options.state)\n    {\n        console.warn(\"Warning: Unknown option 'state'. Did you mean 'initial_state'?\");\n    }\n\n    add_file(\"bios\", options.bios);\n    add_file(\"vga_bios\", options.vga_bios);\n    add_file(\"cdrom\", options.cdrom);\n    add_file(\"hda\", options.hda);\n    add_file(\"hdb\", options.hdb);\n    add_file(\"fda\", options.fda);\n    add_file(\"fdb\", options.fdb);\n    add_file(\"initial_state\", options.initial_state);\n    add_file(\"multiboot\", options.multiboot);\n    add_file(\"bzimage\", options.bzimage);\n    add_file(\"initrd\", options.initrd);\n\n    if(options.filesystem && options.filesystem.handle9p)\n    {\n        settings.handle9p = options.filesystem.handle9p;\n    }","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/copy/v86/blob/180830d539dcc87db1a191febf6c914f516d102f/src/browser/starter.js#L451-L487","documentation":"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.","triggerScenarios":"Calling new V86({... state: <ArrayBuffer or object> }) instead of initial_state when resuming a saved machine snapshot.","commonSituations":"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'.","solutions":["Rename the option from state to initial_state in the V86 constructor options","Ensure the value passed to initial_state matches the format produced by your save routine (v86state buffer from emulator.save_state())","Check other similarly named options against the documented V86 options to catch related renames (e.g. bzimage/initrd, hda) in the same config object"],"exampleFix":"// before\nnew V86({ wasm_path, screen_container, bios: biosBuffer, state: savedState });\n// after\nnew V86({ wasm_path, screen_container, bios: biosBuffer, initial_state: savedState });","handlingStrategy":"validation","validationCode":"function validateV86Options(options)\n{\n    const known = ['wasm_path','screen_container','bios','vga_bios','cdrom','hda','initial_state','bzimage','initrd','memory_size','autostart'];\n    const unknown = Object.keys(options).filter(k => !known.includes(k));\n    if(unknown.includes('state'))\n        throw new Error(\"option 'state' is not supported; use 'initial_state'\");\n    return unknown;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    const emulator = new V86(options);\n}\ncatch(e)\n{\n    if(String(e).includes('initial_state'))\n        console.error('Config error: rename options.state to options.initial_state');\n    throw e;\n}","preventionTips":["Always use initial_state (not state) when restoring v86 snapshots","Validate the V86 options object against the documented keys before constructing","Load saved states only from buffers produced by emulator.save_state()","Pin and read the v86 README/starting.md example config when upgrading versions, since option names can change"],"tags":["configuration","deprecation","typo","v86","snapshot-restore"],"backgroundTag":"unknown-option-deprecated","analyzedSha":"180830d539dcc87db1a191febf6c914f516d102f","analyzedAt":"2026-08-31T22:39:37.599Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}