{"record":{"id":"b03b885841c2d48c","repo":"JanDeDobbeleer/oh-my-posh","slug":"render-expects-4-arguments-configtext-format-da","errorCode":null,"errorMessage":"render expects 4 arguments (configText, format, dataJSON, options), got %d","messagePattern":"render expects 4 arguments \\(configText, format, dataJSON, options\\), got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/wasm/main.go","lineNumber":89,"sourceCode":"\n\tdoc, err := renderSVG(args)\n\tif err != nil {\n\t\treturn map[string]any{\"error\": err.Error()}\n\t}\n\n\treturn map[string]any{\"svg\": doc}\n}\n\n// renderSVG does the actual work: parse the config and optional data from\n// memory, render them, and encode the result - all through config's memory\n// parsers and the render package, never through config.Load or anything\n// else that would touch a file or the network (config.ParseBytes/\n// config.ParseData are exactly the memory-only counterparts to config.Load's\n// file-and-URL-reading Parse; see their own doc comments for why a config\n// parsed this way can never pull in a remote \"extends\").\nfunc renderSVG(args []js.Value) (string, error) {\n\tif len(args) < 4 {\n\t\treturn \"\", fmt.Errorf(\"render expects 4 arguments (configText, format, dataJSON, options), got %d\", len(args))\n\t}\n\n\tconfigText := jsString(args[0])\n\tformat := jsString(args[1])\n\tdataJSON := jsString(args[2])\n\toptions := args[3]\n\n\t// An empty config means the built-in default, the same as it does for the CLI: config.Load\n\t// with no path returns config.Default(). Parsing \"\" instead would produce an empty Config and\n\t// render nothing, so a caller that wants to see what oh-my-posh looks like out of the box -\n\t// the website's own homepage does - has no other way to ask for it.\n\tvar cfg *config.Config\n\n\tvar err error\n\n\tif strings.TrimSpace(configText) == \"\" {\n\t\tcfg = config.Default(nil)\n\t} else {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/wasm/main.go#L71-L107","documentation":"oh-my-posh's WASM module exposes a render() JS binding that renders a prompt config to SVG in the browser. The underlying renderSVG function requires exactly the arguments configText, format, dataJSON, and options. This error is thrown when fewer than 4 arguments are passed to the JS call, and it reports how many were actually received.","triggerScenarios":"Calling wasmBindgen-exported render/renderJS with 0-3 arguments — e.g. render(configText, format, dataJSON) without options, or render(config) with a single object instead of positional args.","commonSituations":"Website/integration code calling the WASM renderer after an API change, wrapping the call and dropping trailing optional-looking arguments, or older documentation showing a shorter signature.","solutions":["Pass all 4 positional arguments: render(configText, format, dataJSON, options)","Pass an empty string for configText to get the default config, and \"{}\"/empty for dataJSON if no data","Pass a valid options object (even an empty JS object) as the 4th argument","Check the current wasm JS glue (render.d.ts / generated bindings) for the exact signature"],"exampleFix":"// before\nconst out = omp.render(cfgText, \"yaml\", JSON.stringify(data));\n// after\nconst out = omp.render(cfgText, \"yaml\", JSON.stringify(data), {});","handlingStrategy":"validation","validationCode":"if (arguments.length < 4) {\n  throw new Error(\"render requires (configText, format, dataJSON, options)\");\n}\nomp.render(configText, format, dataJSON, options ?? {});","typeGuard":null,"tryCatchPattern":"try {\n  const result = omp.render(cfg, fmt, data, opts);\n} catch (e) {\n  if (String(e).includes(\"render expects 4 arguments\")) {\n    // fix the call site signature\n  }\n}","preventionTips":["Wrap the WASM render call in a helper with default args: render(cfg, fmt, data = \"\", opts = {})","Check the generated .d.ts for the exact signature after upgrading the WASM module","Never pass a single options object positionally"],"tags":["go","wasm","javascript","argument-count","arity"],"backgroundTag":"wrong-argument-count","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}