{"record":{"id":"90d260f4916720d6","repo":"gitbutlerapp/gitbutler","slug":"the-detail-result-was-missing-structured-data","errorCode":null,"errorMessage":"The detail result was missing structured data.","messagePattern":"The detail result was missing structured data\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/but-mcp-app/src/WorkspaceApp.tsx","lineNumber":746,"sourceCode":"\t\ttry {\n\t\t\tconst result = await app.callServerTool({\n\t\t\t\tname:\n\t\t\t\t\tnextSelection.kind === \"commit\" ? \"gitbutler_commit_details\" : \"gitbutler_branch_details\",\n\t\t\t\targuments:\n\t\t\t\t\tnextSelection.kind === \"commit\"\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\trepository: view.repository.path,\n\t\t\t\t\t\t\t\tcommitId: nextSelection.commit.id,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\trepository: view.repository.path,\n\t\t\t\t\t\t\t\tbranch: nextSelection.reference.refName.fullName,\n\t\t\t\t\t\t\t},\n\t\t\t});\n\t\t\tif (request !== detailRequest.current) return;\n\t\t\tif (result.isError) throw new Error(textFromToolResult(result));\n\t\t\tconst nextDetail = detailViewFromToolResult(result);\n\t\t\tif (nextDetail === null) throw new Error(\"The detail result was missing structured data.\");\n\t\t\tsetDetail(nextDetail);\n\t\t} catch (caught) {\n\t\t\tif (request !== detailRequest.current) return;\n\t\t\tsetDetailError(caught instanceof Error ? caught.message : \"Could not load details.\");\n\t\t} finally {\n\t\t\tif (request === detailRequest.current) setDetailLoading(false);\n\t\t}\n\t}\n\n\tasync function handleCopy(value: string) {\n\t\tsetDetailError(null);\n\t\ttry {\n\t\t\tawait copyText(value);\n\t\t\tsetCopied(value);\n\t\t\twindow.setTimeout(() => setCopied((current) => (current === value ? null : current)), 1600);\n\t\t} catch (caught) {\n\t\t\tsetDetailError(caught instanceof Error ? caught.message : \"Could not copy the identifier.\");\n\t\t}","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/2497b8007aa4a1922dae9a805b32ffe5b5037785/packages/but-mcp-app/src/WorkspaceApp.tsx#L728-L764","documentation":"Thrown at WorkspaceApp.tsx:746 when the detail tool returned success but detailViewFromToolResult returned null: structuredContent is not an object with both kind and details, or its kind is neither \"commit\" nor \"branch\". Displayed via setDetailError as \"The detail result was missing structured data.\" while the panel keeps its loading/error state.","triggerScenarios":"A tool version that emits text-only results or a changed schema (kind renamed, details regrouped); version skew between but-mcp-app and the server tool; an MCP host that drops structuredContent from the notification.","commonSituations":"Partial upgrades of the desktop app versus the but CLI; schema evolution of the detail payload between releases.","solutions":["Update the but CLI/desktop so the tool emits {kind, details} in structuredContent","Log result.structuredContent to identify the missing or renamed key","Update detailViewFromToolResult if the schema legitimately changed","Keep tool and UI versions in lockstep across releases"],"exampleFix":"// before\nconst nextDetail = detailViewFromToolResult(result);\nif (nextDetail === null) throw new Error(\"The detail result was missing structured data.\");\n\n// after — report the shape actually received\nconst nextDetail = detailViewFromToolResult(result);\nif (nextDetail === null) {\n\tconst kind = (result.structuredContent as any)?.kind;\n\tthrow new Error(`The detail result was missing structured data (kind: ${typeof kind === \"string\" ? kind : \"absent\"}).`);\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isDetailView(v: unknown): v is DetailView {\n\tif (typeof v !== \"object\" || v === null) return false;\n\tif (!(\"kind\" in v) || !(\"details\" in v)) return false;\n\treturn v.kind === \"commit\" || v.kind === \"branch\";\n}","tryCatchPattern":"const nextDetail = detailViewFromToolResult(result);\nif (nextDetail === null) {\n\t// schema drift or text-only result: show an actionable message, keep the panel usable\n\tsetDetailError(\"The detail result was missing structured data.\");\n} else {\n\tsetDetail(nextDetail);\n}","preventionTips":["Update the but CLI/desktop together so detail tools emit {kind, details}","Log structuredContent on mismatch to spot renamed keys early","Extend detailViewFromToolResult whenever the detail schema legitimately changes","Keep detail errors panel-local so the workspace list stays usable"],"tags":["mcp","workspace","schema-validation"],"backgroundTag":"mcp-structured-content-missing","analyzedSha":"2497b8007aa4a1922dae9a805b32ffe5b5037785","analyzedAt":"2026-08-17T00:30:25.648Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}