gitbutlerapp/gitbutler · error
The detail result was missing structured data.
Error message
The detail result was missing structured data.
What it means
select requires the detail tool response to carry structured data; when detailViewFromToolResult returns null (no structuredContent or unparseable shape) this invariant error is thrown even though the call reported success. It indicates a schema/contract mismatch between the app and the host tool.
Solutions
- Log the raw tool result to see what structured content actually came back.
- Refresh the workspace and retry the selection to rule out a mid-flight reference removal.
- Align the but-mcp-app parser with the host's current tool schema.
- Fall back to rendering the tool's text content instead of failing the panel.
- File an internal-invariant bug with the payload if reproducible on matching versions.
Example fix
// before
const nextDetail = detailViewFromToolResult(result);
if (nextDetail === null) throw new Error("The detail result was missing structured data.");
// after
const nextDetail = detailViewFromToolResult(result);
if (nextDetail === null) {
setDetailError(textFromToolResult(result) || "No details available.");
return;
} Defensive patterns
Strategy: type-guard
Validate before calling
const raw = result.structuredContent;
if (raw == null) {
setDetailError(textFromToolResult(result) || "No structured detail data returned.");
return;
} Type guard
function isDetailView(v: unknown): v is DetailView {
return typeof v === "object" && v !== null &&
"repository" in v && Array.isArray((v as DetailView).files ?? null);
} Try / catch
const nextDetail = detailViewFromToolResult(result);
if (!isDetailView(nextDetail)) {
setDetailError("Detail unavailable for this selection.");
return;
} // skip the throw entirely
setDetail(nextDetail); Prevention
- Validate structured content shape before casting it to DetailView.
- Keep the parser in sync with the host tool schema; add a schema/version handshake if possible.
- Render the tool's text content as a fallback when structured data is absent.
- Add tests covering empty structuredContent responses.
When it happens
Trigger: The detail tool responds successfully but with only text content, empty structuredContent, or a payload that detailViewFromToolResult cannot deserialize into a DetailView.
Common situations: Host and app version skew (tool response schema changed); a selection whose detail cannot be represented (e.g. a reference that vanished mid-request); host bug returning empty structured content for certain branch types.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- The updated review was missing from the response.
- anchor is always present in the order at this point
- At least one review number is required
- Change to discard at
- commits cannot be moved to the merge base
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/90d260f4916720d6.
Report an issue: GitHub.
Appendix: source
Thrown at packages/but-mcp-app/src/WorkspaceApp.tsx:746
try {
const result = await app.callServerTool({
name:
nextSelection.kind === "commit" ? "gitbutler_commit_details" : "gitbutler_branch_details",
arguments:
nextSelection.kind === "commit"
? {
repository: view.repository.path,
commitId: nextSelection.commit.id,
}
: {
repository: view.repository.path,
branch: nextSelection.reference.refName.fullName,
},
});
if (request !== detailRequest.current) return;
if (result.isError) throw new Error(textFromToolResult(result));
const nextDetail = detailViewFromToolResult(result);
if (nextDetail === null) throw new Error("The detail result was missing structured data.");
setDetail(nextDetail);
} catch (caught) {
if (request !== detailRequest.current) return;
setDetailError(caught instanceof Error ? caught.message : "Could not load details.");
} finally {
if (request === detailRequest.current) setDetailLoading(false);
}
}
async function handleCopy(value: string) {
setDetailError(null);
try {
await copyText(value);
setCopied(value);
window.setTimeout(() => setCopied((current) => (current === value ? null : current)), 1600);
} catch (caught) {
setDetailError(caught instanceof Error ? caught.message : "Could not copy the identifier.");
}View on GitHub (pinned to 58e5313667)