{"record":{"id":"3c7dbbcdeac650bc","repo":"vitest-dev/vitest","slug":"data-was-not-properly-initialized-this-is-a-bug-i","errorCode":null,"errorMessage":"Data was not properly initialized. This is a bug in Vitest. Please, open a new issue with reproduction.","messagePattern":"Data was not properly initialized\\. This is a bug in Vitest\\. Please, open a new issue with reproduction\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser/src/client/tester/tester.ts","lineNumber":229,"sourceCode":"    })\n  }\n\n  state.durations.prepare = performance.now() - options.startTime\n\n  return {\n    runner,\n    config,\n    state,\n  }\n}\n\nlet preparedData:\n  | Awaited<ReturnType<typeof prepareTestEnvironment>>\n  | undefined\n\nasync function executeTests(method: 'run' | 'collect', specifications: FileSpecification[]) {\n  if (!preparedData) {\n    throw new Error(`Data was not properly initialized. This is a bug in Vitest. Please, open a new issue with reproduction.`)\n  }\n\n  debug?.('runner resolved successfully')\n\n  const { runner, state } = preparedData\n\n  state.ctx.files = specifications\n  runner.setMethod(method)\n\n  const version = url.searchParams.get('browserv') || ''\n  specifications.forEach(({ filepath }) => {\n    const currentVersion = browserHashMap.get(filepath)\n    if (!currentVersion || currentVersion[1] !== version) {\n      browserHashMap.set(filepath, version)\n    }\n  })\n\n  for (const file of specifications) {","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/browser/src/client/tester/tester.ts#L211-L247","documentation":"Thrown by `executeTests` when the module-level `preparedData` is still undefined. `preparedData` is populated by `prepareTestEnvironment` (which builds the runner, RPC, mocker, and worker state) before `executeTests` is called. If `executeTests` runs first, the runner/state/config are missing and execution cannot proceed. The message explicitly flags this as a Vitest internal bug rather than a user error.","triggerScenarios":"The browser tester's bootstrap sequence is interrupted or reordered so `executeTests('run'|'collect', specs)` is called before `prepareTestEnvironment` completes; a custom entry point that calls `executeTests` directly.","commonSituations":"An upstream Vitest regression in the tester bootstrap; a race where the runner message arrives before environment preparation; a customized tester HTML/entry that skips `prepareTestEnvironment`.","solutions":["Use the standard Vitest browser tester entry point that calls `prepareTestEnvironment` before `executeTests`.","If customizing the tester, ensure `prepareTestEnvironment` has resolved before invoking `executeTests`.","Treat as a Vitest bug: open an issue with a minimal reproduction."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// internal contract: prepareTestEnvironment must run first\nif (!preparedData) {\n  await prepareTestEnvironment(opts)\n}\nawait executeTests('run', specs)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the standard browser tester entry point that prepares before executing.","Do not invoke `executeTests` from custom code without preparing first.","Report regressions as Vitest bugs with a reproduction."],"tags":["internal","browser","runner","bootstrap"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}