googleapis/mcp-toolbox · error

invalid jobStateMatcher: %s. Supported values: ALL, ACTIVE,

Error message

invalid jobStateMatcher: %s. Supported values: ALL, ACTIVE, NON_ACTIVE

What it means

Thrown by ListJobs when the jobStateMatcher parameter is non-empty but is not one of the recognized protobuf enum names (ALL, ACTIVE, NON_ACTIVE). The library maps the string to dataprocpb.ListJobsRequest_JobStateMatcher and rejects unknown values before issuing the RPC.

Source

Thrown at internal/sources/dataproc/dataproc.go:299

	req := &dataprocpb.ListJobsRequest{
		ProjectId: s.Project,
		Region:    s.Region,
	}

	if pageSize != nil {
		req.PageSize = int32(*pageSize)
	}
	if pageToken != "" {
		req.PageToken = pageToken
	}
	if filter != "" {
		req.Filter = filter
	}
	if jobStateMatcher != "" {
		if v, ok := dataprocpb.ListJobsRequest_JobStateMatcher_value[jobStateMatcher]; ok {
			req.JobStateMatcher = dataprocpb.ListJobsRequest_JobStateMatcher(v)
		} else {
			return nil, fmt.Errorf("invalid jobStateMatcher: %s. Supported values: ALL, ACTIVE, NON_ACTIVE", jobStateMatcher)
		}
	}

	it := client.ListJobs(ctx, req)
	ps := 0
	if pageSize != nil {
		ps = *pageSize
	}
	pager := iterator.NewPager(it, ps, req.PageToken)

	var jobPbs []*dataprocpb.Job
	nextPageToken, err := pager.NextPage(&jobPbs)
	if err != nil {
		return nil, fmt.Errorf("failed to list jobs: %w", err)
	}

	jobs, err := ToJobs(jobPbs, s.Region)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Use one of the exact uppercase values: ALL, ACTIVE, or NON_ACTIVE.
  2. Correct case: "active" → "ACTIVE", "non-active" → "NON_ACTIVE".
  3. If filtering by other criteria (e.g., job state time), put it in the filter parameter, not jobStateMatcher.
  4. Omit jobStateMatcher entirely to use the API default.

Example fix

// before
{"jobStateMatcher": "active"}

// after
{"jobStateMatcher": "ACTIVE"}
Defensive patterns

Strategy: validation

Validate before calling

var jobStateMatcher string
valid := map[string]bool{"ALL": true, "ACTIVE": true, "NON_ACTIVE": true}
if jobStateMatcher != "" && !valid[jobStateMatcher] {
    return fmt.Errorf("jobStateMatcher must be one of ALL, ACTIVE, NON_ACTIVE; got %q", jobStateMatcher)
}

Type guard

func validJobStateMatcher(s string) bool {
    switch s {
    case "ALL", "ACTIVE", "NON_ACTIVE", "":
        return true
    }
    return false
}

Try / catch

jobs, err := src.ListJobs(ctx, ..., jobStateMatcher)
if err != nil && strings.Contains(err.Error(), "invalid jobStateMatcher") {
    // normalize input (uppercase, map "non-active"->"NON_ACTIVE") and retry once
    return err
}

Prevention

When it happens

Trigger: Calling the list-jobs tool with jobStateMatcher set to any string other than exactly "ALL", "ACTIVE", or "NON_ACTIVE" — e.g., lowercase "active", "nonactive", or a free-text filter.

Common situations: LLM or client generating case-incorrect values ("active"), hyphenated variants ("non-active"), or passing filter expressions into the matcher field by mistake.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/0f82db24206acfea. Report an issue: GitHub.