{"record":{"id":"bbb4f519c3c1a589","repo":"windmill-labs/windmill","slug":"invalid-worker-group-config","errorCode":null,"errorMessage":"Invalid worker group config","messagePattern":"Invalid worker group config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/routes/(root)/(logged)/workers/+page.svelte","lineNumber":366,"sourceCode":"\tlet importConfigDrawer: Drawer | undefined = $state(undefined)\n\tlet importConfigCode = $state('')\n\tlet tag: string = $state('')\n\tasync function importSingleWorkerConfig(c: any) {\n\t\tif (typeof c === 'object' && c !== null) {\n\t\t\tif (!c.name || typeof c.name !== 'string') {\n\t\t\t\tthrow new Error('Invalid worker group config name')\n\t\t\t}\n\n\t\t\tif (workerGroups?.hasOwnProperty(c.name)) {\n\t\t\t\tthrow new Error(`Worker group config with the name ${c.name} already exists`)\n\t\t\t}\n\n\t\t\tawait ConfigService.updateConfig({\n\t\t\t\tname: 'worker__' + c.name,\n\t\t\t\trequestBody: { ...c, name: undefined }\n\t\t\t})\n\t\t} else {\n\t\t\tthrow new Error('Invalid worker group config')\n\t\t}\n\t}\n\n\tasync function importConfigFromYaml() {\n\t\tconst config = YAML.parse(importConfigCode)\n\n\t\ttry {\n\t\t\tif (Array.isArray(config)) {\n\t\t\t\tfor (const c of config) {\n\t\t\t\t\tawait importSingleWorkerConfig(c)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tawait importSingleWorkerConfig(config)\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tif (err instanceof Error) {\n\t\t\t\tsendUserToast(err.message, true)\n\t\t\t} else {","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/routes/(root)/(logged)/workers/+page.svelte#L348-L384","documentation":"importSingleWorkerConfig accepts only non-null plain objects as worker group configs; anything else (string, number, array element, null) hits the else branch and throws 'Invalid worker group config'. It protects ConfigService.updateConfig from being called with a shape the backend can't store.","triggerScenarios":"YAML where a worker_groups list contains scalar entries (e.g. just names as strings), the parsed top-level is a list instead of objects, or YAML.parse produced null/undefined for a malformed block.","commonSituations":"Writing 'worker_groups: [groupA, groupB]' instead of a list of maps; broken YAML indentation collapsing a group to a scalar; pasting JSON with quoted-but-wrong structure; empty file parsing to null.","solutions":["Ensure every worker group entry in the YAML is a mapping (key: value pairs), not a scalar or list","Validate the YAML parses to the expected shape (e.g. console.log the parsed object) before importing","Fix indentation so nested fields belong to the group object","Start from a known-good exported config as a template"],"exampleFix":"// before\nworker_groups:\n  - group-a\n  - group-b\n// after\nworker_groups:\n  - name: group-a\n    concurrency: 5\n  - name: group-b\n    concurrency: 5","handlingStrategy":"type-guard","validationCode":"const parsed = YAML.parse(importConfigCode)\nconst entries = Array.isArray(parsed) ? parsed : parsed?.worker_groups ?? []\nif (!entries.every(c => typeof c === 'object' && c !== null && !Array.isArray(c))) {\n  sendUserToast('Every worker group must be a YAML mapping of key/value pairs', true)\n  return\n}","typeGuard":"function isWorkerConfigObject(c: unknown): c is Record<string, unknown> {\n  return typeof c === 'object' && c !== null && !Array.isArray(c)\n}","tryCatchPattern":"try {\n  await importConfigFromYaml()\n} catch (e) {\n  if (e.message === 'Invalid worker group config') {\n    sendUserToast('YAML entries must be mappings like { name: ..., concurrency: ... }, not scalars', true)\n  } else throw e\n}","preventionTips":["Wrap YAML.parse in try/catch separately — malformed YAML parses to null","Show a preview of the parsed object before import","Validate against a schema (list of objects with required name)","Start imports from a known-good exported template"],"tags":["validation","yaml","workers","import"],"backgroundTag":"schema-validation-failed","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"}