{"record":{"id":"b4c5a9dfafc8d463","repo":"multica-ai/multica","slug":"command-name-must-be-a-single-executable-token-pu","errorCode":null,"errorMessage":"command_name must be a single executable token; put arguments in fixed_args","messagePattern":"command_name must be a single executable token; put arguments in fixed_args","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/internal/handler/runtime_profile.go","lineNumber":108,"sourceCode":"\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\")\n\t}\n\treturn nil\n}\n\ntype createRuntimeProfileRequest struct {\n\tDisplayName    string   `json:\"display_name\"`\n\tProtocolFamily string   `json:\"protocol_family\"`\n\tCommandName    string   `json:\"command_name\"`\n\tDescription    *string  `json:\"description\"`\n\tFixedArgs      []string `json:\"fixed_args\"`\n\tEnabled        *bool    `json:\"enabled\"`\n}\n\n// CreateRuntimeProfile creates a workspace runtime profile. Admin-gated by the\n// router. protocol_family is validated against the agent backend whitelist.","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/handler/runtime_profile.go#L90-L126","documentation":"validateRuntimeProfileCommandName rejects command_name values containing spaces, tabs, or newlines. The field must be a single executable token (argv[0]); everything else belongs in fixed_args. This prevents clients from smuggling a full command line into one field, which the backend would otherwise exec incorrectly or unsafely.","triggerScenarios":"POST/PUT a runtime profile with command_name: \"node server.js\", \"npx -y @scope/agent\", or a value with a trailing \\n from a textarea. Happens when a form has one 'command' box and the developer pastes the whole command line.","commonSituations":"Single-input UX for 'command' instead of separate command + args fields; shell snippets copied from docs into the command field; multi-line textarea values with invisible newlines.","solutions":["Split the command line: first token into command_name, the rest into fixed_args","Trim the input and reject embedded newlines in the client form","Label the form fields explicitly ('Executable' vs 'Arguments') to guide users"],"exampleFix":"// before\n{ command_name: \"npx -y @scope/agent\" }\n// after\n{ command_name: \"npx\", fixed_args: [\"-y\", \"@scope/agent\"] }","handlingStrategy":"validation","validationCode":"const parts = commandLine.trim().split(/\\s+/);\nconst commandName = parts[0];\nconst fixedArgs = parts.slice(1);\nif (/\\s/.test(commandName)) throw new Error('Executable must be a single token');","typeGuard":"function isSingleToken(s: string): boolean {\n  return s.length > 0 && !/[ \\t\\r\\n]/.test(s);\n}","tryCatchPattern":null,"preventionTips":["Split UI into separate Executable and Arguments fields","Never paste a full shell command into the executable field","Trim textarea input to kill trailing newlines"],"tags":["validation","runtime-profile","argv","parsing"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}