{"record":{"id":"691d4d177af86f2b","repo":"grpc-ecosystem/grpc-gateway","slug":"invalid-percent-encoding-in-q","errorCode":null,"errorMessage":"invalid percent-encoding in %q","messagePattern":"invalid percent-encoding in %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/httprule/parse.go","lineNumber":328,"sourceCode":"\t\tcase '0' <= r && r <= '9':\n\t\t\tcontinue\n\t\t}\n\t\tswitch r {\n\t\tcase '-', '.', '_', '~':\n\t\t\t// unreserved\n\t\tcase '!', '$', '&', '\\'', '(', ')', '*', '+', ',', ';', '=':\n\t\t\t// sub-delims\n\t\tcase ':', '@':\n\t\t\t// rest of pchar\n\t\tcase '%':\n\t\t\t// pct-encoded\n\t\t\tst = pct1\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"invalid character in path segment: %q(%U)\", r, r)\n\t\t}\n\t}\n\tif st != init {\n\t\treturn fmt.Errorf(\"invalid percent-encoding in %q\", t)\n\t}\n\treturn nil\n}\n\n// expectIdent determines if \"ident\" is a valid identifier in .proto schema ([[:alpha:]_][[:alphanum:]_]*).\nfunc expectIdent(ident string) error {\n\tif ident == \"\" {\n\t\treturn errors.New(\"empty identifier\")\n\t}\n\tfor pos, r := range ident {\n\t\tswitch {\n\t\tcase '0' <= r && r <= '9':\n\t\t\tif pos == 0 {\n\t\t\t\treturn fmt.Errorf(\"identifier starting with digit: %s\", ident)\n\t\t\t}\n\t\t\tcontinue\n\t\tcase 'A' <= r && r <= 'Z':\n\t\t\tcontinue","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/internal/httprule/parse.go#L310-L346","documentation":"Lexical-validation error from expectPChars: the literal ended while a percent-encoding was mid-parse (state pct1/pct2), i.e. a trailing '%' or '%A' with fewer than two hex digits. The input string is reported so the truncated escape can be found.","triggerScenarios":"Thrown at internal/httprule/parse.go:328 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Complete the percent-escape with exactly two hex digits, or remove the dangling '%'.","Encode a literal percent as %25."],"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"}