windmill-labs/windmill · error

type is required when path is provided.

Error message

type is required when path is provided.

What it means

Thrown by diffWorkspaceItem when a `path` is supplied without its `type`. The workspace diff lookup is keyed by the (type, path) pair — draft and deployed sides cannot be resolved from the path alone, so this is an argument-completeness guard on the tool input.

Source

Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6473

// Read-only draft-vs-deployed diff for one draftable item, served from the
// workspace diff snapshot (fetched once, shared with the index), with a direct
// computation fallback when no draft row is listed.
async function diffWorkspaceItem(
	args: {
		type?: WorkspaceItemType
		path?: string
		trigger_kind?: TriggerKind
		file?: string
		offset?: number
		limit?: number
	},
	ctx: WriteDraftCtx
): Promise<string> {
	const { workspace, toolId, toolCallbacks } = ctx
	const { type, path, trigger_kind: triggerKind } = args
	if (!type || !path) {
		throw new Error('type is required when path is provided.')
	}
	const itemKind = itemKindFor(type, triggerKind)
	if (!itemKind) {
		throw new Error('trigger_kind is required when type is trigger.')
	}
	toolCallbacks.setToolStatus(toolId, {
		content: `Comparing draft vs deployed for "${path}"...`
	})

	// Address the draft by its storage path (a draft_only item lives at a
	// synthetic `u/{user}/draft_{uuid}` key) and flush any parked editor autosave
	// first so the server overlay reflects the latest edit — the same resolution
	// the deploy path uses. Unlike deploy: a flush conflict/failure doesn't abort
	// a read-only diff (surfaced as a caveat), and the auto-save toggle is
	// honored — with auto-save off, a read-only tool must not persist edits the
	// user chose to keep local. The just-flushed row must not be served from the
	// throttled listing cache, so expire it.
	// The chat `app` type spans two draft kinds: raw apps AND classic apps —

View on GitHub (pinned to e474e8803c)

Solutions

  1. Pass both `type` and `path` when diffing a specific item
  2. Omit `path` entirely to diff the currently open item instead
  3. Map the item's path to its WorkspaceItemType before calling
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6473 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/0b941be3e5267aaa. Report an issue: GitHub.