{"record":{"id":"0ef5ea479bb1a5ff","repo":"koala73/worldmonitor","slug":"a-framework-named-fw-name-already-exists-ren","errorCode":null,"errorMessage":"A framework named '${fw.name}' already exists. Rename the existing one first.","messagePattern":"A framework named '(.+?)' already exists\\. Rename the existing one first\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/services/analysis-framework-store.ts","lineNumber":126,"sourceCode":"\nconst _activeCache = new Map<AnalysisPanelId, AnalysisFramework | null>();\n\nexport function loadFrameworkLibrary(): AnalysisFramework[] {\n  const imported = loadFromStorage<AnalysisFramework[]>(LIBRARY_KEY, []);\n  return [...BUILT_IN_FRAMEWORKS, ...imported];\n}\n\nexport function saveImportedFramework(fw: Omit<AnalysisFramework, 'isBuiltIn' | 'createdAt'>): void {\n  const imported = loadFromStorage<AnalysisFramework[]>(LIBRARY_KEY, []);\n  if (imported.length >= MAX_IMPORTED) {\n    throw new Error(`Library is full (max ${MAX_IMPORTED} imported frameworks).`);\n  }\n  if (fw.systemPromptAppend.length > MAX_INSTRUCTIONS_LEN) {\n    throw new Error(`Instructions exceed the ${MAX_INSTRUCTIONS_LEN}-character limit (${fw.systemPromptAppend.length} chars). Trim and retry.`);\n  }\n  const existing = loadFrameworkLibrary();\n  if (existing.some(f => f.name === fw.name)) {\n    throw new Error(`A framework named '${fw.name}' already exists. Rename the existing one first.`);\n  }\n  const newFw: AnalysisFramework = { ...fw, isBuiltIn: false, createdAt: Date.now() };\n  saveToStorage(LIBRARY_KEY, [...imported, newFw]);\n  _activeCache.clear();\n}\n\nexport function deleteImportedFramework(id: string): void {\n  if (BUILT_IN_FRAMEWORKS.some(f => f.id === id)) return;\n  const imported = loadFromStorage<AnalysisFramework[]>(LIBRARY_KEY, []);\n  saveToStorage(LIBRARY_KEY, imported.filter(f => f.id !== id));\n  _activeCache.clear();\n}\n\nexport function renameImportedFramework(id: string, name: string): void {\n  if (BUILT_IN_FRAMEWORKS.some(f => f.id === id)) return;\n  const imported = loadFromStorage<AnalysisFramework[]>(LIBRARY_KEY, []);\n  saveToStorage(LIBRARY_KEY, imported.map(f => f.id === id ? { ...f, name } : f));\n  _activeCache.clear();","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/src/services/analysis-framework-store.ts#L108-L144","documentation":"Client-side uniqueness check in saveImportedFramework: an imported framework with the same name already exists in the library. Names must be unique among imported frameworks so selection and updates are unambiguous.","triggerScenarios":"Thrown at src/services/analysis-framework-store.ts:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename or delete the existing framework with that name first","Edit the existing framework instead of importing a duplicate"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}