semaphoreui/semaphore · error

invalid format of the TaskRunner extra arguments, must be…

Error message

invalid format of the TaskRunner extra arguments, must be valid JSON

What it means

Returned by LocalExecutor.getCLIArgs in services/tasks/local_executor.go when task-level arguments fail to parse. It fires only when the template allows overriding arguments in the task (AllowOverrideArgsInTask) and the Task.Arguments string is not valid JSON for a []string — the offending input is the extra arguments supplied on the TaskRunner/task, which must be a JSON array of strings.

Solutions

  1. Edit the task's arguments to a JSON string array such as ["--limit","web1"]
  2. Remove non-JSON quoting or trailing commas from the task arguments field
  3. Disable 'allow override args in task' on the template if the override is not intended, so only the validated template arguments are used
  4. Run the value through a JSON linter before resubmitting the task
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at services/tasks/local_executor.go:647 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07). Data as JSON: /api/errors/2be995c57bc19c67. Report an issue: GitHub.

Appendix: source

Thrown at services/tasks/local_executor.go:647

	}

	return
}

func (t *LocalExecutor) getCLIArgs() (templateArgs []string, taskArgs []string, err error) {

	if t.Template.Arguments != nil {
		err = json.Unmarshal([]byte(*t.Template.Arguments), &templateArgs)
		if err != nil {
			err = fmt.Errorf("invalid format of the template extra arguments, must be valid JSON")
			return
		}
	}

	if t.Template.AllowOverrideArgsInTask && t.Task.Arguments != nil {
		err = json.Unmarshal([]byte(*t.Task.Arguments), &taskArgs)
		if err != nil {
			err = fmt.Errorf("invalid format of the TaskRunner extra arguments, must be valid JSON")
			return
		}
	}

	return
}

// convertArgsJSONIfArray converts array format JSON to map format with "default" key and returns the parsed result
func convertArgsJSONIfArray(argsJSON string) (map[string][]string, error) {
	if argsJSON == "" {
		return nil, nil
	}

	// Try to parse as array first
	var arr []string
	if err := json.Unmarshal([]byte(argsJSON), &arr); err == nil {
		// It's an array, convert to map format
		mapArgs := map[string][]string{

View on GitHub (pinned to 1774ccb71a)