github/github-mcp-server · error

field_filters: %q is not a valid number for %q: %s

Error message

field_filters: %q is not a valid number for %q: %s

What it means

For a NUMBER issue field, resolveFieldFilters parses the string value with strconv.ParseFloat and reports the parse error on failure. Values must be numeric strings; scientific notation (1e3) is accepted by ParseFloat, but thousand separators, units, and empty strings are not.

Source

Thrown at pkg/github/issues.go:3147

					optionNames = append(optionNames, o.Name)
				}
				return nil, fmt.Errorf("field_filters: %q is not a valid option for %q. Valid options: %s", rf.Value, field.Name, strings.Join(optionNames, ", "))
			}
			v := githubv4.String(matched)
			filter.SingleSelectOptionValue = &v
		case "TEXT":
			v := githubv4.String(rf.Value)
			filter.TextValue = &v
		case "DATE":
			if _, err := time.Parse("2006-01-02", rf.Value); err != nil {
				return nil, fmt.Errorf("field_filters: %q is not a valid date for %q (expected YYYY-MM-DD): %s", rf.Value, field.Name, err.Error())
			}
			v := githubv4.String(rf.Value)
			filter.DateValue = &v
		case "NUMBER":
			n, err := strconv.ParseFloat(rf.Value, 64)
			if err != nil {
				return nil, fmt.Errorf("field_filters: %q is not a valid number for %q: %s", rf.Value, field.Name, err.Error())
			}
			v := githubv4.Float(n)
			filter.NumberValue = &v
		default:
			return nil, fmt.Errorf("field_filters: field %q has unsupported data_type %q", field.Name, field.DataType)
		}
		out = append(out, filter)
	}
	return out, nil
}

// parseISOTimestamp parses an ISO 8601 timestamp string into a time.Time object.
// Returns the parsed time or an error if parsing fails.
// Example formats supported: "2023-01-15T14:30:00Z", "2023-01-15"
func parseISOTimestamp(timestamp string) (time.Time, error) {
	if timestamp == "" {
		return time.Time{}, fmt.Errorf("empty timestamp")
	}

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Send a plain numeric string such as "42" or "3.14"
  2. Strip thousand separators and units before sending
  3. For integer-typed fields, prefer values without decimal points to avoid surprising matches

Example fix

// before
{"field_filters":[{"field_name":"Points","value":"1,000"}]}
// after
{"field_filters":[{"field_name":"Points","value":"1000"}]}
Defensive patterns

Strategy: validation

Validate before calling

func validFilterNumber(s string) bool {
	if s == "" {
		return false
	}
	_, err := strconv.ParseFloat(s, 64)
	return err == nil
}

Type guard

func isNumericString(s string) bool {
	_, err := strconv.ParseFloat(strings.TrimSpace(s), 64)
	return err == nil
}

Prevention

When it happens

Trigger: field_filters entry on a NUMBER field with a value like "1,000", "~5", "3 stars", or "".

Common situations: Locale-formatted numbers with commas or decimal commas; an LLM appending units; copying display-formatted values from UI text.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/f99abe994b09730d. Report an issue: GitHub.