{"record":{"id":"03c205fcb1d35def","repo":"different-ai/openwork","slug":"common-something-went-wrong","errorCode":"common.something_went_wrong","errorMessage":"t(\"common.something_went_wrong\")","messagePattern":"t\\(\"common\\.something_went_wrong\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/settings/pages/mcp-view.tsx","lineNumber":603,"sourceCode":"    && Boolean(cloudSession.authToken.trim())\n    && Boolean(cloudSession.activeOrganization?.id.trim());\n  const handleAddKind = (kind: LibraryAddKind) => {\n    const action = libraryAddAction(kind, libraryAddOptions);\n    if (!action) return;\n    if (action.type === \"workspace-mcp\") {\n      setAddMcpModalOpen(true);\n      return;\n    }\n    if (action.type === \"den-url\") {\n      const url = denAddUrl(denBaseUrl, action.kind);\n      if (url) void openDesktopUrl(url);\n      return;\n    }\n    setAddAuthorableKind(action.kind);\n  };\n  const handleCreateLibraryItem = async (input: CreateLibraryItemInput) => {\n    if (!addAuthorableKind || !props.createLibraryItem) {\n      throw new Error(t(\"common.something_went_wrong\"));\n    }\n    const createdId = await props.createLibraryItem(addAuthorableKind, input);\n    const pendingFiles = addAuthorableKind === \"plugin\"\n      ? (input.components ?? []).map((component, index) => ({\n        configObjectId: `pending:${index}`,\n        objectType: component.kind,\n        title: component.name.trim(),\n        path: \"\",\n        versionId: null,\n        updatedAt: null,\n        skillName: component.kind === \"skill\" ? slugifyLibraryItemName(component.name, \"skill\") : undefined,\n      }))\n      : [{\n        configObjectId: \"pending\",\n        objectType: addAuthorableKind,\n        title: input.name.trim(),\n        path: \"\",\n        versionId: null,","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx#L585-L621","documentation":"handleCreateLibraryItem in McpView creates an MCP/plugin library item, but requires an authorable kind (plugin/mcp config) selected and a createLibraryItem callback prop supplied by the parent. If either is missing it throws the localized \"common.something_went_wrong\" instead of calling an undefined function.","triggerScenarios":"Submitting the create-library-item dialog when no addAuthorableKind was set (handleAddAction not completed) or the parent did not pass props.createLibraryItem.","commonSituations":"Parent view rendered McpView without wiring createLibraryItem; user somehow submits the add form before choosing an item type; state reset between dialog open and submit.","solutions":["Ensure the parent passes a createLibraryItem prop to McpView","Complete the add-flow selection (setAddAuthorableKind) before allowing submit","Guard/disable the submit button until a kind is selected"],"exampleFix":"// before\n<McpView onAddAction={...} /> // missing createLibraryItem\n// after\n<McpView onAddAction={...} createLibraryItem={createLibraryItem} />","handlingStrategy":"try-catch","validationCode":"if (!addAuthorableKind || !props.createLibraryItem) {\n  showToast(t(\"common.something_went_wrong\"));\n  return;\n}","typeGuard":"const canCreate = (\n  k: unknown,\n  fn: unknown,\n): k is CreateLibraryItemInput => k != null && typeof fn === \"function\";","tryCatchPattern":"try {\n  await handleCreateLibraryItem(input);\n} catch (e) {\n  if ((e as Error).message.includes(\"something_went_wrong\")) resetAddFlow();\n  else throw e;\n}","preventionTips":["Always supply createLibraryItem when embedding McpView","Only open the create dialog after a kind is selected","Type the required props as non-optional in the component contract"],"tags":["mcp","missing-prop","ui-state"],"backgroundTag":"missing-required-argument","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}