gitbutlerapp/gitbutler · error

The detail result was missing structured data.

Error message

The detail result was missing structured data.

What it means

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.

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 2497b8007a)

Solutions

  1. Update the but CLI/desktop so the tool emits {kind, details} in structuredContent
  2. Log result.structuredContent to identify the missing or renamed key
  3. Update detailViewFromToolResult if the schema legitimately changed
  4. Keep tool and UI versions in lockstep across releases

Example fix

// before
const nextDetail = detailViewFromToolResult(result);
if (nextDetail === null) throw new Error("The detail result was missing structured data.");

// after — report the shape actually received
const nextDetail = detailViewFromToolResult(result);
if (nextDetail === null) {
	const kind = (result.structuredContent as any)?.kind;
	throw new Error(`The detail result was missing structured data (kind: ${typeof kind === "string" ? kind : "absent"}).`);
}
Defensive patterns

Strategy: type-guard

Type guard

function isDetailView(v: unknown): v is DetailView {
	if (typeof v !== "object" || v === null) return false;
	if (!("kind" in v) || !("details" in v)) return false;
	return v.kind === "commit" || v.kind === "branch";
}

Try / catch

const nextDetail = detailViewFromToolResult(result);
if (nextDetail === null) {
	// schema drift or text-only result: show an actionable message, keep the panel usable
	setDetailError("The detail result was missing structured data.");
} else {
	setDetail(nextDetail);
}

Prevention

When it happens

Trigger: 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.

Common situations: Partial upgrades of the desktop app versus the but CLI; schema evolution of the detail payload between releases.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@2497b8007a (2026-08-17). Data as JSON: /api/errors/90d260f4916720d6. Report an issue: GitHub.