{"record":{"id":"b4b23c12661627de","repo":"grpc-ecosystem/grpc-gateway","slug":"no-field-path","errorCode":null,"errorMessage":"no field path","messagePattern":"no field path","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"runtime/query.go","lineNumber":107,"sourceCode":"\t\tif i == len(fieldPath)-1 {\n\t\t\tbreak\n\t\t}\n\n\t\t// Only singular message fields are allowed\n\t\tif fieldDesc.Message() == nil || fieldDesc.Cardinality() == protoreflect.Repeated {\n\t\t\treturn fieldPath\n\t\t}\n\n\t\t// Get the nested message\n\t\tmsgValue = msgValue.Get(fieldDesc).Message()\n\t}\n\n\treturn newFieldPath\n}\n\nfunc populateFieldValueFromPath(msgValue protoreflect.Message, fieldPath []string, values []string) error {\n\tif len(fieldPath) < 1 {\n\t\treturn errors.New(\"no field path\")\n\t}\n\tif len(values) < 1 {\n\t\treturn errors.New(\"no value provided\")\n\t}\n\n\tvar fieldDescriptor protoreflect.FieldDescriptor\n\tfor i, fieldName := range fieldPath {\n\t\tfields := msgValue.Descriptor().Fields()\n\n\t\t// Get field by name\n\t\tfieldDescriptor = fields.ByName(protoreflect.Name(fieldName))\n\t\tif fieldDescriptor == nil {\n\t\t\tfieldDescriptor = fields.ByJSONName(fieldName)\n\t\t\tif fieldDescriptor == nil {\n\t\t\t\t// We're not returning an error here because this could just be\n\t\t\t\t// an extra query parameter that isn't part of the request.\n\t\t\t\tgrpclog.Infof(\"field not found in %q: %q\", msgValue.Descriptor().FullName(), strings.Join(fieldPath, \".\"))\n\t\t\t\treturn nil","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/runtime/query.go#L89-L125","documentation":"Returned by populateFieldValueFromPath (reached via runtime.PopulateFieldFromPath / Parse) when the fieldPath slice is empty, i.e. there is no field name to populate on the message. It guards against calling the field-population logic with nothing to do.","triggerScenarios":"Calling runtime.PopulateFieldFromPath(msg, urlPath, \"\") with an empty field path string, or Parse/query parsing producing a zero-length fieldPath before populateFieldValueFromPath is invoked.","commonSituations":"Custom query-parameter or HTTP-body mapping code splitting an empty path string; config-driven field mappings where a field name key is missing/blank; template variables that resolve to empty strings.","solutions":["Ensure the field path string passed to PopulateFieldFromPath is non-empty and well-formed (dot-separated, e.g. \"user.id\")","Guard the call site: skip population when the path is empty instead of forwarding it","Fix the config/template that produced a blank field name"],"exampleFix":"// before\nif err := runtime.PopulateFieldFromPath(msg, urlPath, fieldPath); err != nil {...}\n// after\nif fieldPath != \"\" {\n    if err := runtime.PopulateFieldFromPath(msg, urlPath, fieldPath); err != nil {...}\n}","handlingStrategy":"validation","validationCode":"if fieldPath == \"\" {\n    return nil // skip: nothing to populate\n}\nfor _, part := range strings.Split(fieldPath, \".\") {\n    if part == \"\" {\n        return fmt.Errorf(\"invalid field path %q\", fieldPath)\n    }\n}","typeGuard":"func isValidFieldPath(p string) bool {\n    return p != \"\" && !strings.HasPrefix(p, \".\") && !strings.HasSuffix(p, \".\") && !strings.Contains(p, \"..\")\n}","tryCatchPattern":"if err := runtime.PopulateFieldFromPath(msg, urlPath, fieldPath); err != nil {\n    return fmt.Errorf(\"populate %q: %w\", fieldPath, err)\n}","preventionTips":["Validate config-driven field mappings at startup, rejecting empty names","Never pass raw string splits of empty inputs into PopulateFieldFromPath","Log the full field path in wrappers to speed up debugging"],"tags":["go","grpc-gateway","query","field-path"],"backgroundTag":"missing-field-path","analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}