{"record":{"id":"316f9caa710d99e0","repo":"usebruno/bruno","slug":"failed-to-reopen-collection-after-migration","errorCode":null,"errorMessage":"Failed to reopen collection after migration","messagePattern":"Failed to reopen collection after migration","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/yml-migration.js","lineNumber":282,"sourceCode":"    mainWindow.webContents.send('main:display-error', { message });\n  };\n  // The renderer dropped the collection from its store before invoking us, so on every\n  // exit — success, failure or cancel — re-open from disk; the renderer re-creates and\n  // mounts it fresh via the normal main:collection-opened flow (same deterministic uid).\n  // openCollection catches load errors and returns { opened: false, error } rather than\n  // always throwing, so treat that shape as failure too.\n  const reopenCollection = async () => {\n    let result;\n    try {\n      result = await openCollection(mainWindow, watcher, collectionPathname);\n    } catch (reopenError) {\n      console.error('Failed to reopen collection after migration:', reopenError);\n      throw reopenError;\n    }\n    if (result?.opened === false) {\n      const message = result.error || 'Failed to reopen collection after migration';\n      console.error('Failed to reopen collection after migration:', message);\n      throw new Error(message);\n    }\n  };\n\n  let result;\n  try {\n    result = await migrateCollectionOnDisk({\n      collectionPathname,\n      brunoConfig,\n      backupRootDir: path.join(app.getPath('userData'), 'tmp', 'yml-migration'),\n      checkCancelled,\n      emitProgress,\n      reportError\n    });\n\n    // Remap .bru → .yml tab paths across EVERY workspace snapshot entry for this\n    // collection. Force-flushing only rewrites the active workspace; shared\n    // collections keep per-workspace tab lists that would otherwise restore as\n    // dead \"Not Found\" tabs after switching workspaces.","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/yml-migration.js#L264-L300","documentation":"Error \"Failed to reopen collection after migration\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/ipc/yml-migration.js:282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close and reopen the collection manually from its directory.","Check the collection directory still exists and is readable."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}