multica-ai/multica · error

command_name cannot contain NUL bytes

Error message

command_name cannot contain NUL bytes

What it means

validateRuntimeProfileCommandName rejects command_name values containing a NUL byte. Same rationale as the fixed_args NUL check: Go strings carry NUL fine, but exec argv cannot, so a NUL would truncate the executable path at spawn time. Failing at validation surfaces the corruption immediately.

Source

Thrown at server/internal/handler/runtime_profile.go:111

			return nil, errors.New("fixed_args entries must be non-empty")
		}
		if strings.ContainsRune(a, '\x00') {
			return nil, errors.New("fixed_args entries cannot contain NUL bytes")
		}
		clean = append(clean, a)
	}
	return json.Marshal(clean)
}

func validateRuntimeProfileCommandName(commandName string) error {
	if commandName == "" {
		return errors.New("command_name is required")
	}
	if strings.ContainsAny(commandName, " \t\r\n") {
		return errors.New("command_name must be a single executable token; put arguments in fixed_args")
	}
	if strings.ContainsRune(commandName, '\x00') {
		return errors.New("command_name cannot contain NUL bytes")
	}
	return nil
}

type createRuntimeProfileRequest struct {
	DisplayName    string   `json:"display_name"`
	ProtocolFamily string   `json:"protocol_family"`
	CommandName    string   `json:"command_name"`
	Description    *string  `json:"description"`
	FixedArgs      []string `json:"fixed_args"`
	Enabled        *bool    `json:"enabled"`
}

// CreateRuntimeProfile creates a workspace runtime profile. Admin-gated by the
// router. protocol_family is validated against the agent backend whitelist.
func (h *Handler) CreateRuntimeProfile(w http.ResponseWriter, r *http.Request) {
	wsID := strings.TrimSpace(chi.URLParam(r, "id"))
	member, ok := h.requireWorkspaceMember(w, r, wsID, "workspace not found")

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Strip NULs and control characters from the command string before sending
  2. Validate input is printable UTF-8 at the client boundary
  3. Treat NUL in this field as a bug in the producer — find and fix the source of the binary data

Example fix

// before
commandName: buf.toString("utf8")
// after
commandName: buf.toString("utf8").replace(/[\x00\r\n]/g, "").trim()
Defensive patterns

Strategy: validation

Validate before calling

if (commandName.includes('\x00')) {
  throw new Error('Corrupt input: NUL byte in executable name');
}

Type guard

function isNulFreeCommand(s: string): boolean { return !s.includes('\x00'); }

Prevention

When it happens

Trigger: POST/PUT a runtime profile whose command_name contains \u0000 — binary-corrupted input, fuzzed payloads, or a buffer decoded with the wrong encoding.

Common situations: Command read from a binary protocol or fixed-width record padded with NULs; encoding bugs (UTF-32 decoded as bytes); penetration-test payloads probing argv injection.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/556686266ce48242. Report an issue: GitHub.