windmill-labs/windmill · error · Error
Variable "${args.path}" does not exist yet, so creating it r
Error message
Variable "${args.path}" does not exist yet, so creating it requires both value and is_secret. What it means
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.
Source
Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:4667
// `get_variable` sends these as explicit nulls; carrying a null through would add
// `account: null` / `expires_at: null` to the draft and to every diff the user
// reviews. Undefined drops out of the JSON instead.
account: variable.account ?? undefined,
is_oauth: variable.is_oauth ?? undefined,
expires_at: variable.expires_at ?? undefined
}
}
function resolveVariableWrite(
args: WriteVariableArgs,
base?: VariableDraftState
): {
is_secret: boolean
value: string
description: string
} {
if (base === undefined && (args.value === undefined || args.is_secret === undefined)) {
throw new Error(
`Variable "${args.path}" does not exist yet, so creating it requires both value and is_secret.`
)
}
const is_secret = args.is_secret ?? base?.variable.is_secret ?? false
// '' is the sentinel for "nothing staged" in a secret draft, so it cannot also mean
// "set the secret to empty". Refusing it matters because a model reaching for a
// placeholder — the habit this schema change removes — would otherwise wipe the secret.
if (is_secret && args.value === '') {
throw new Error(
`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.`
)
}
// Securing one needs a value too when it holds none: the deploy would send no `value`
// (nothing is staged) and the backend refuses an is_secret change without one. Saying
// so here keeps the model from having to interpret that error.
if (
is_secret &&
base?.variable.is_secret === false &&View on GitHub (pinned to e474e8803c)
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)
Example fix
// before
writeVariable({ path: 'u/admin/API_KEY', value: 'abc' })
// after
writeVariable({ path: 'u/admin/API_KEY', value: 'abc', is_secret: true }) Defensive patterns
Strategy: validation
Validate before calling
if (!existing && (args.value === undefined || args.is_secret === undefined)) {
throw new Error('creating requires value and is_secret');
} Type guard
function canCreateVariable(args) { return typeof args.value === 'string' && typeof args.is_secret === 'boolean'; } Try / catch
try { writeVariable(args) } catch (e) { if (e.message.includes('requires both value and is_secret')) addMissingFields(args); } Prevention
- Always pass value and is_secret when creating a new variable
- Confirm the path exists before doing a partial update
When it happens
Trigger: A write_variable tool call for a path that does not exist yet, where args.value or args.is_secret is undefined.
Common situations: 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).
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- trigger_kind is required when type is trigger.
- An empty string is not a valid value for secret variable "${
- Cannot make variable "${args.path}" secret without a value:
- Cannot turn secret variable "${args.path}" into a non-secret
- Draft variable "${draftValue.path}" is secret but stages no
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/c8b422e74edcc473.
Report an issue: GitHub.