{"record":{"id":"0b8ac96d413538c2","repo":"windmill-labs/windmill","slug":"parsing-error-should-be-before-it-likely-m","errorCode":null,"errorMessage":"Parsing error `:` should be before `=`\nit likely means you are trying to set default value to record or table which is not supported at the moment.","messagePattern":"Parsing error `:` should be before `=`\nit likely means you are trying to set default value to record or table which is not supported at the moment\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-nu/src/lib.rs","lineNumber":121,"sourceCode":"                            .get(0..t)\n                            .ok_or(anyhow!(\"Cannot parse argument ident\"))?\n                            .trim(),\n                        Some(parse_type(\n                            &batch\n                                .get(t..d)\n                                .ok_or(anyhow!(\"Cannot parse type of argument\"))?,\n                        )?),\n                        Some(parse_default(\n                            &batch\n                                .get(d..)\n                                .ok_or(anyhow!(\"Cannot parse default value of argument\"))?,\n                            &batches,\n                            i,\n                            &mut compensate_lookahead,\n                        )?),\n                    )\n                } else {\n                    bail!(\"Parsing error `:` should be before `=`\\nit likely means you are trying to set default value to record or table which is not supported at the moment.\")\n                }\n            }\n        };\n\n        // Check if it is optional\n        let optional = {\n            let Some(element) = name.chars().last() else {\n                bail!(\"Internal error, cannot check if argument is optional\")\n            };\n            element == '?'\n        };\n\n        // Rest parameters are not supported\n        if matches!(name.get(0..3), Some(\"...\")) {\n            bail!(\"Rest (...) parameters are not supported\")\n        }\n\n        // Flags are not supported","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-nu/src/lib.rs#L103-L139","documentation":"When parsing `def main` parameters, the parser splits each batch on `:` (type) and `=` (default). If the `=` appears before the `:`, the parameter is shaped like `x = {a: 1}: record` — a default value on a record/table literal — which the grammar cannot represent, so it bails with this explanatory message. Windmill's signature parser does not support assigning defaults to record or table literals in that position.","triggerScenarios":"Declaring a main parameter whose default value contains `:` before the type annotation effectively does — e.g. `def main [config = {mode: fast}]` or `def main [tbl = [[a]; [1]]]`-style record/table literal defaults, where the literal's internal `:` lands after `=` so type_start > default_start.","commonSituations":"Using a record literal (`{key: value}`) or table literal as a default parameter value in a Nushell script; defaults with colons such as URLs or time literals before a type annotation.","solutions":["Remove the default and require the caller to pass the value (use `ident?` optional-with-null if acceptable).","Annotate the type explicitly before the default: `ident: record = {...}` is still limited — if unsupported, pass records via a JSON resource or input instead.","Restructure so the default is a supported scalar (string/int/float/bool/list) without `:` in it.","Handle the record inside the script body: accept `any`/`record` without default and use `default`/`if empty` logic in code."],"exampleFix":"// before\ndef main [config = {mode: fast}]\n// after\ndef main [mode: string = \"fast\"]","handlingStrategy":"validation","validationCode":"function validateNuParamDefaults(sigLine) {\n  const t = sigLine.indexOf(':'), d = sigLine.indexOf('=');\n  if (d !== -1 && t !== -1 && d < t) return 'default value appears before type; record/table literal defaults with `:` are not supported — use scalar defaults like `x: string = \"a\"`';\n  return null;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const sig = parseNuSignature(source);\n} catch (e) {\n  if (String(e).includes('`:` should be before `=`')) {\n    throw new Error('Move the default to a supported scalar form, or drop the default and pass the value at call time');\n  }\n  throw e;\n}","preventionTips":["Never use record/table literal defaults ({...: ...}, [[...]]) in def main parameters","Prefer scalar defaults (string/int/float/bool) or nullable optional params (`ident?`)","Do complex default construction inside the script body after checking for null"],"tags":["nushell","parser","default-value","records"],"backgroundTag":"unsupported-default-value","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"}