{"record":{"id":"0b941be3e5267aaa","repo":"windmill-labs/windmill","slug":"type-is-required-when-path-is-provided","errorCode":null,"errorMessage":"type is required when path is provided.","messagePattern":"type is required when path is provided\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":6473,"sourceCode":"\n// Read-only draft-vs-deployed diff for one draftable item, served from the\n// workspace diff snapshot (fetched once, shared with the index), with a direct\n// computation fallback when no draft row is listed.\nasync function diffWorkspaceItem(\n\targs: {\n\t\ttype?: WorkspaceItemType\n\t\tpath?: string\n\t\ttrigger_kind?: TriggerKind\n\t\tfile?: string\n\t\toffset?: number\n\t\tlimit?: number\n\t},\n\tctx: WriteDraftCtx\n): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks } = ctx\n\tconst { type, path, trigger_kind: triggerKind } = args\n\tif (!type || !path) {\n\t\tthrow new Error('type is required when path is provided.')\n\t}\n\tconst itemKind = itemKindFor(type, triggerKind)\n\tif (!itemKind) {\n\t\tthrow new Error('trigger_kind is required when type is trigger.')\n\t}\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Comparing draft vs deployed for \"${path}\"...`\n\t})\n\n\t// Address the draft by its storage path (a draft_only item lives at a\n\t// synthetic `u/{user}/draft_{uuid}` key) and flush any parked editor autosave\n\t// first so the server overlay reflects the latest edit — the same resolution\n\t// the deploy path uses. Unlike deploy: a flush conflict/failure doesn't abort\n\t// a read-only diff (surfaced as a caveat), and the auto-save toggle is\n\t// honored — with auto-save off, a read-only tool must not persist edits the\n\t// user chose to keep local. The just-flushed row must not be served from the\n\t// throttled listing cache, so expire it.\n\t// The chat `app` type spans two draft kinds: raw apps AND classic apps —","sourceCodeStart":6455,"sourceCodeEnd":6491,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L6455-L6491","documentation":"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.","triggerScenarios":"Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:6473 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass both `type` and `path` when diffing a specific item","Omit `path` entirely to diff the currently open item instead","Map the item's path to its WorkspaceItemType before calling"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}