{"record":{"id":"c8b422e74edcc473","repo":"windmill-labs/windmill","slug":"variable-args-path-does-not-exist-yet-so-cre","errorCode":null,"errorMessage":"Variable \"${args.path}\" does not exist yet, so creating it requires both value and is_secret.","messagePattern":"Variable \"(.+?)\" does not exist yet, so creating it requires both value and is_secret\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":4667,"sourceCode":"\t\t// `get_variable` sends these as explicit nulls; carrying a null through would add\n\t\t// `account: null` / `expires_at: null` to the draft and to every diff the user\n\t\t// reviews. Undefined drops out of the JSON instead.\n\t\taccount: variable.account ?? undefined,\n\t\tis_oauth: variable.is_oauth ?? undefined,\n\t\texpires_at: variable.expires_at ?? undefined\n\t}\n}\n\nfunction resolveVariableWrite(\n\targs: WriteVariableArgs,\n\tbase?: VariableDraftState\n): {\n\tis_secret: boolean\n\tvalue: string\n\tdescription: string\n} {\n\tif (base === undefined && (args.value === undefined || args.is_secret === undefined)) {\n\t\tthrow new Error(\n\t\t\t`Variable \"${args.path}\" does not exist yet, so creating it requires both value and is_secret.`\n\t\t)\n\t}\n\tconst is_secret = args.is_secret ?? base?.variable.is_secret ?? false\n\t// '' is the sentinel for \"nothing staged\" in a secret draft, so it cannot also mean\n\t// \"set the secret to empty\". Refusing it matters because a model reaching for a\n\t// placeholder — the habit this schema change removes — would otherwise wipe the secret.\n\tif (is_secret && args.value === '') {\n\t\tthrow new Error(\n\t\t\t`An empty string is not a valid value for secret variable \"${args.path}\". Omit value to keep the stored secret, or pass the real new one.`\n\t\t)\n\t}\n\t// Securing one needs a value too when it holds none: the deploy would send no `value`\n\t// (nothing is staged) and the backend refuses an is_secret change without one. Saying\n\t// so here keeps the model from having to interpret that error.\n\tif (\n\t\tis_secret &&\n\t\tbase?.variable.is_secret === false &&","sourceCodeStart":4649,"sourceCodeEnd":4685,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L4649-L4685","documentation":"Creating a brand-new variable requires both value and is_secret since there is no existing variable to inherit defaults from. This error fires when args.path has no existing base variable (base === undefined) and either value or is_secret is omitted.","triggerScenarios":"A write_variable tool call for a path that does not exist yet, where args.value or args.is_secret is undefined.","commonSituations":"The model tries to create a variable while omitting is_secret, or stages a partial update for a variable that does not exist (typo'd path).","solutions":["Include both value and is_secret in the write_variable call","Check the path for typos — if the variable should exist, read it first to confirm the exact path","Set is_secret explicitly (true for secrets, false otherwise)"],"exampleFix":"// before\nwriteVariable({ path: 'u/admin/API_KEY', value: 'abc' })\n// after\nwriteVariable({ path: 'u/admin/API_KEY', value: 'abc', is_secret: true })","handlingStrategy":"validation","validationCode":"if (!existing && (args.value === undefined || args.is_secret === undefined)) {\n  throw new Error('creating requires value and is_secret');\n}","typeGuard":"function canCreateVariable(args) { return typeof args.value === 'string' && typeof args.is_secret === 'boolean'; }","tryCatchPattern":"try { writeVariable(args) } catch (e) { if (e.message.includes('requires both value and is_secret')) addMissingFields(args); }","preventionTips":["Always pass value and is_secret when creating a new variable","Confirm the path exists before doing a partial update"],"tags":["ai-copilot","variables","missing-argument"],"backgroundTag":"missing-required-argument","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"}