{"record":{"id":"f7b1a526f425bc28","repo":"grpc-ecosystem/grpc-gateway","slug":"unexpected-token-q-after-segments-q","errorCode":null,"errorMessage":"unexpected token %q after segments %q","messagePattern":"unexpected token %q after segments %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/httprule/parse.go","lineNumber":131,"sourceCode":"\n// parser is a parser of the template syntax defined in github.com/googleapis/googleapis/google/api/http.proto.\ntype parser struct {\n\ttokens   []string\n\taccepted []string\n}\n\n// topLevelSegments is the target of this parser.\nfunc (p *parser) topLevelSegments() ([]segment, error) {\n\tif _, err := p.accept(typeEOF); err == nil {\n\t\tp.tokens = p.tokens[:0]\n\t\treturn []segment{literal(eof)}, nil\n\t}\n\tsegs, err := p.segments()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := p.accept(typeEOF); err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected token %q after segments %q\", p.tokens[0], strings.Join(p.accepted, \"\"))\n\t}\n\treturn segs, nil\n}\n\nfunc (p *parser) segments() ([]segment, error) {\n\ts, err := p.segment()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsegs := []segment{s}\n\tfor {\n\t\tif _, err := p.accept(\"/\"); err != nil {\n\t\t\treturn segs, nil\n\t\t}\n\t\ts, err := p.segment()\n\t\tif err != nil {\n\t\t\treturn segs, err","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/internal/httprule/parse.go#L113-L149","documentation":"Parser error from parser.topLevelSegments: after consuming all path-template segments, trailing tokens remain before EOF (e.g. an unmatched '}' or stray text in the HttpRule pattern). The template string is not a complete valid path expression; the error shows the first leftover token and the segments parsed so far.","triggerScenarios":"Thrown at internal/httprule/parse.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the HttpRule path template to remove trailing/unexpected characters.","Balance braces and wildcards; end the template cleanly (e.g. '/v1/things/{id}' or with '=**' variants)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}