{"record":{"id":"3a0a060f855de4f8","repo":"windmill-labs/windmill","slug":"invalid-note-at-index-index-size-must-be-an-ob","errorCode":null,"errorMessage":"Invalid note at index ${index}: size must be an object with numeric width and height","messagePattern":"Invalid note at index (.+?): size must be an object with numeric width and height","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/flow/helperUtils.ts","lineNumber":214,"sourceCode":"\t\t\t\ttypeof p !== 'object' ||\n\t\t\t\tArray.isArray(n.position) ||\n\t\t\t\ttypeof p.x !== 'number' ||\n\t\t\t\ttypeof p.y !== 'number'\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid note at index ${index}: position must be an object with numeric x and y`\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tif (n.size !== undefined && n.size !== null) {\n\t\t\tconst s = n.size as Record<string, unknown>\n\t\t\tif (\n\t\t\t\ttypeof s !== 'object' ||\n\t\t\t\tArray.isArray(n.size) ||\n\t\t\t\ttypeof s.width !== 'number' ||\n\t\t\t\ttypeof s.height !== 'number'\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid note at index ${index}: size must be an object with numeric width and height`\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tif (type === 'group' && n.contained_node_ids !== undefined) {\n\t\t\tif (\n\t\t\t\t!Array.isArray(n.contained_node_ids) ||\n\t\t\t\tn.contained_node_ids.some((id) => typeof id !== 'string')\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid note at index ${index}: contained_node_ids must be an array of strings`\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (moduleIds) {\n\t\t\t\tfor (const id of n.contained_node_ids as string[]) {\n\t\t\t\t\tif (!moduleIds.has(id)) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Invalid note at index ${index}: contained_node_ids \"${id}\" does not match any flow module`","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/flow/helperUtils.ts#L196-L232","documentation":"validateFlowNotes also checks the optional `size` of each flow note: when supplied it must be a plain object with numeric `width` and `height`. The library throws this error to reject sizes given in the wrong shape or with non-numeric values before notes are rendered on the flow.","triggerScenarios":"Passing notes[i].size as \"200x100\", an array [200,100], or {width: \"200\", height: \"100\"} (string values), or omitting one of width/height, when invoking the note/flowTools tool.","commonSituations":"LLM-generated size fields arrive as strings; a caller copies CSS-style dimensions (\"200px\"); size is passed as a two-element array by habit from canvas APIs.","solutions":["Coerce to numbers in an object: size: { width: Number(w), height: Number(h) }.","Strip units from CSS-like strings before passing (parse \"200px\" to 200).","Omit `size` to let the validator compute a size from the note text.","Inspect the note at the reported index for the malformed size field."],"exampleFix":"// before\nnotes: [{ id: 'n1', text: 'todo', size: { width: '200', height: '100' } }]\n// after\nnotes: [{ id: 'n1', text: 'todo', size: { width: 200, height: 100 } }]","handlingStrategy":"validation","validationCode":"function hasValidSize(n) {\n  return n.size == null ||\n    (typeof n.size === 'object' && !Array.isArray(n.size) &&\n     typeof n.size.width === 'number' && typeof n.size.height === 'number')\n}\nnotes.forEach((n, i) => { if (!hasValidSize(n)) throw new Error(`note ${i}: bad size`) })","typeGuard":"function isSize(s): s is { width: number; height: number } {\n  return typeof s === 'object' && s !== null && !Array.isArray(s) &&\n    typeof (s as any).width === 'number' && typeof (s as any).height === 'number'\n}","tryCatchPattern":"try {\n  validateFlowNotes(notes)\n} catch (e) {\n  if (e.message.includes('size')) console.warn('dropping note size, will size from text')\n}","preventionTips":["Use numeric width/height without units","Parse CSS-like dimension strings into numbers first","Omit size to let the validator derive it from the note text"],"tags":["validation","typescript","flow-notes","schema"],"backgroundTag":"invalid-tool-argument-shape","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"}