grpc-ecosystem/grpc-gateway · error

empty identifier

Error message

empty identifier

What it means

Validation-helper error from expectIdent: the identifier token expected by the httprule parser (a proto-schema identifier [[:alpha:]_][[:alphanum:]_]*) is the empty string. It fires when accept(typeIdent) is handed an empty token, typically from a malformed path template with a missing field name (e.g. '{=v}' or a trailing '.').

Source

Thrown at internal/httprule/parse.go:336

		case ':', '@':
			// rest of pchar
		case '%':
			// pct-encoded
			st = pct1
		default:
			return fmt.Errorf("invalid character in path segment: %q(%U)", r, r)
		}
	}
	if st != init {
		return fmt.Errorf("invalid percent-encoding in %q", t)
	}
	return nil
}

// expectIdent determines if "ident" is a valid identifier in .proto schema ([[:alpha:]_][[:alphanum:]_]*).
func expectIdent(ident string) error {
	if ident == "" {
		return errors.New("empty identifier")
	}
	for pos, r := range ident {
		switch {
		case '0' <= r && r <= '9':
			if pos == 0 {
				return fmt.Errorf("identifier starting with digit: %s", ident)
			}
			continue
		case 'A' <= r && r <= 'Z':
			continue
		case 'a' <= r && r <= 'z':
			continue
		case r == '_':
			continue
		default:
			return fmt.Errorf("invalid character %q(%U) in identifier: %s", r, r, ident)
		}
	}

View on GitHub (pinned to a58a4436a3)

Solutions

  1. Fix the google.api.HttpRule path template so every variable and field-path component has a non-empty, valid identifier.
  2. Check for stray separators like '..', '=.' or an empty '{}' variable in the template.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/httprule/parse.go:336 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grpc-ecosystem/grpc-gateway@a58a4436a3 (2026-09-02). Data as JSON: /api/errors/29526d5fe116b4a3. Report an issue: GitHub.