different-ai/openwork · error

common.something_went_wrong

common.something_went_wrong

Error message

t("common.something_went_wrong")

What it means

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.

Source

Thrown at apps/app/src/react-app/domains/settings/pages/mcp-view.tsx:603

    && Boolean(cloudSession.authToken.trim())
    && Boolean(cloudSession.activeOrganization?.id.trim());
  const handleAddKind = (kind: LibraryAddKind) => {
    const action = libraryAddAction(kind, libraryAddOptions);
    if (!action) return;
    if (action.type === "workspace-mcp") {
      setAddMcpModalOpen(true);
      return;
    }
    if (action.type === "den-url") {
      const url = denAddUrl(denBaseUrl, action.kind);
      if (url) void openDesktopUrl(url);
      return;
    }
    setAddAuthorableKind(action.kind);
  };
  const handleCreateLibraryItem = async (input: CreateLibraryItemInput) => {
    if (!addAuthorableKind || !props.createLibraryItem) {
      throw new Error(t("common.something_went_wrong"));
    }
    const createdId = await props.createLibraryItem(addAuthorableKind, input);
    const pendingFiles = addAuthorableKind === "plugin"
      ? (input.components ?? []).map((component, index) => ({
        configObjectId: `pending:${index}`,
        objectType: component.kind,
        title: component.name.trim(),
        path: "",
        versionId: null,
        updatedAt: null,
        skillName: component.kind === "skill" ? slugifyLibraryItemName(component.name, "skill") : undefined,
      }))
      : [{
        configObjectId: "pending",
        objectType: addAuthorableKind,
        title: input.name.trim(),
        path: "",
        versionId: null,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Ensure the parent passes a createLibraryItem prop to McpView
  2. Complete the add-flow selection (setAddAuthorableKind) before allowing submit
  3. Guard/disable the submit button until a kind is selected

Example fix

// before
<McpView onAddAction={...} /> // missing createLibraryItem
// after
<McpView onAddAction={...} createLibraryItem={createLibraryItem} />
Defensive patterns

Strategy: try-catch

Validate before calling

if (!addAuthorableKind || !props.createLibraryItem) {
  showToast(t("common.something_went_wrong"));
  return;
}

Type guard

const canCreate = (
  k: unknown,
  fn: unknown,
): k is CreateLibraryItemInput => k != null && typeof fn === "function";

Try / catch

try {
  await handleCreateLibraryItem(input);
} catch (e) {
  if ((e as Error).message.includes("something_went_wrong")) resetAddFlow();
  else throw e;
}

Prevention

When it happens

Trigger: Submitting the create-library-item dialog when no addAuthorableKind was set (handleAddAction not completed) or the parent did not pass props.createLibraryItem.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/03c205fcb1d35def. Report an issue: GitHub.