{"record":{"id":"e408765c9f5c271f","repo":"googleapis/mcp-toolbox","slug":"s-is-not-a-valid-http-method","errorCode":null,"errorMessage":"%s is not a valid http method","messagePattern":"(.+?) is not a valid http method","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/http_method.go","lineNumber":45,"sourceCode":"func isValidHTTPMethod(method string) bool {\n\n\tswitch method {\n\tcase http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete,\n\t\thttp.MethodPatch, http.MethodHead, http.MethodOptions, http.MethodTrace,\n\t\thttp.MethodConnect:\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (i *HTTPMethod) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {\n\tvar httpMethod string\n\tif err := unmarshal(&httpMethod); err != nil {\n\t\treturn fmt.Errorf(`error unmarshalling HTTP method: %s`, err)\n\t}\n\thttpMethod = strings.ToUpper(httpMethod)\n\tif !isValidHTTPMethod(httpMethod) {\n\t\treturn fmt.Errorf(`%s is not a valid http method`, httpMethod)\n\t}\n\t*i = HTTPMethod(httpMethod)\n\treturn nil\n}\n","sourceCodeStart":27,"sourceCodeEnd":50,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/http_method.go#L27-L50","documentation":"After successfully unmarshalling the method string, it is uppercased and checked against the set of valid HTTP methods (GET, POST, PUT, DELETE, etc.). This error means the configured method string is not one of the supported HTTP verbs.","triggerScenarios":"A tools.yaml http tool declares method: fetch, method: patch (if unsupported), method: getall, or a typo like method: gtet; the string parses fine as YAML but fails isValidHTTPMethod after uppercasing.","commonSituations":"Typos in hand-edited configs; invented verbs ('UPSERT', 'READ'); casing confusion (handled by ToUpper, so this is genuinely an invalid verb, not a case issue); older configs written for a fork supporting extra verbs.","solutions":["Replace the method value with a standard HTTP verb: GET, POST, PUT, DELETE, PATCH, or HEAD as supported by isValidHTTPMethod","Fix the typo in the config (e.g. gtet -> get)","Check the library version's supported method list and upgrade if a needed verb is missing"],"exampleFix":"// before\nmethod: fetch\n// after\nmethod: GET","handlingStrategy":"validation","validationCode":"var valid = map[string]bool{\"GET\":true,\"POST\":true,\"PUT\":true,\"DELETE\":true,\"PATCH\":true,\"HEAD\":true}\nm := strings.ToUpper(cfg.Method)\nif !valid[m] {\n    return fmt.Errorf(\"%s is not a valid http method\", m)\n}","typeGuard":null,"tryCatchPattern":"if err := yaml.Unmarshal(data, &cfg); err != nil {\n    if strings.HasSuffix(strings.TrimSpace(err.Error()), \"is not a valid http method\") {\n        // correct the method verb in tools.yaml\n    }\n    return err\n}","preventionTips":["Use only standard HTTP verbs in configs; check isValidHTTPMethod's list","Keep a canonical tools.yaml template with method pre-filled","Lint configs against a schema that enum-constrains method"],"tags":["yaml","configuration","http","validation"],"backgroundTag":"invalid-http-method","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}