{"record":{"id":"922230a4c06185de","repo":"multica-ai/multica","slug":"fixed-args-entries-must-be-non-empty","errorCode":null,"errorMessage":"fixed_args entries must be non-empty","messagePattern":"fixed_args entries must be non-empty","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/internal/handler/runtime_profile.go","lineNumber":93,"sourceCode":"// paths do not yet enforce 'private', so accepting 'private' from a client\n// would silently leak a \"private\" profile's name/command to other members and\n// let other machines' daemons register it (lateral data leak). Re-expose a\n// visibility control only once those read paths enforce creator visibility.\n// Follow-up: MUL-3308.\nconst runtimeProfileDefaultVisibility = \"workspace\"\n\n// marshalFixedArgs validates and JSON-encodes the fixed_args list. Each entry\n// must be a non-empty string; the column defaults to an empty array.\nfunc marshalFixedArgs(args []string) ([]byte, error) {\n\tif len(args) == 0 {\n\t\treturn []byte(\"[]\"), nil\n\t}\n\tclean := make([]string, 0, len(args))\n\tfor _, a := range args {\n\t\t// fixed_args are launch flags inherited by every agent on the runtime;\n\t\t// blank entries are always a client mistake.\n\t\tif strings.TrimSpace(a) == \"\" {\n\t\t\treturn nil, errors.New(\"fixed_args entries must be non-empty\")\n\t\t}\n\t\tif strings.ContainsRune(a, '\\x00') {\n\t\t\treturn nil, errors.New(\"fixed_args entries cannot contain NUL bytes\")\n\t\t}\n\t\tclean = append(clean, a)\n\t}\n\treturn json.Marshal(clean)\n}\n\nfunc validateRuntimeProfileCommandName(commandName string) error {\n\tif commandName == \"\" {\n\t\treturn errors.New(\"command_name is required\")\n\t}\n\tif strings.ContainsAny(commandName, \" \\t\\r\\n\") {\n\t\treturn errors.New(\"command_name must be a single executable token; put arguments in fixed_args\")\n\t}\n\tif strings.ContainsRune(commandName, '\\x00') {\n\t\treturn errors.New(\"command_name cannot contain NUL bytes\")","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/handler/runtime_profile.go#L75-L111","documentation":"marshalFixedArgs validates the fixed_args list on a runtime profile create/update: every entry must be a non-empty, non-whitespace-only string. fixed_args are launch flags inherited by every agent on the runtime, so a blank entry would become an empty argv element passed to the spawned command and is always a client mistake. Empty input list is fine; blank entries inside the list are not.","triggerScenarios":"POST/PUT a runtime profile with fixed_args: [\"\", \"--verbose\"] or [\"   \"]. Typical when a form splits a arguments string on spaces (\"--flag  --other\" double space yields \"\") or appends an optional flag that was never filled in.","commonSituations":"Arguments textfield split with args.trim().split(/\\s+/) producing empty tokens on leading/trailing spaces; building flags conditionally and appending undefined/empty strings; copy-paste from a shell command with stray whitespace.","solutions":["Filter blanks before sending: fixed_args.filter(a => a.trim() !== \"\")","When splitting a command line, split on /\\s+/ after trimming the whole string","If the flag is optional and unset, omit the entry entirely from the array"],"exampleFix":"// before\nfixedArgs: rawArgs.split(\" \")\n// after\nfixedArgs: rawArgs.trim().split(/\\s+/).filter(Boolean)","handlingStrategy":"validation","validationCode":"const cleanArgs = fixedArgs.filter(a => typeof a === 'string' && a.trim() !== '');\nif (cleanArgs.length !== fixedArgs.length) warn('Dropped blank fixed_args entries');","typeGuard":"function areCleanFixedArgs(args: unknown[]): boolean {\n  return args.every(a => typeof a === 'string' && a.trim().length > 0);\n}","tryCatchPattern":null,"preventionTips":["Split command strings on /\\s+/ after trimming, never on a single space","Filter Boolean after conditional flag assembly","Reject blank rows in the args editor UI before submit"],"tags":["validation","runtime-profile","argv"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}