hashicorp/nomad · error

invalid publish_time: %w

Error message

invalid publish_time: %w

What it means

Fired by the keyring rotate root-key HTTP endpoint when the publish_time query parameter cannot be parsed as a 64-bit integer with strconv.ParseInt; the raw string is passed through with %w so the strconv error is preserved.

Source

Thrown at command/agent/keyring_endpoint.go:186

	args := structs.KeyringRotateRootKeyRequest{}
	s.parseWriteRequest(req, &args.WriteRequest)

	query := req.URL.Query()
	switch query.Get("algo") {
	case string(structs.EncryptionAlgorithmAES256GCM):
		args.Algorithm = structs.EncryptionAlgorithmAES256GCM
	}

	if _, ok := query["full"]; ok {
		args.Full = true
	}

	ptRaw := query.Get("publish_time")
	if ptRaw != "" {
		publishTime, err := strconv.ParseInt(ptRaw, 10, 64)
		if err != nil {
			return nil, fmt.Errorf("invalid publish_time: %w", err)
		}
		args.PublishTime = publishTime
	}

	var out structs.KeyringRotateRootKeyResponse
	if err := s.agent.RPC("Keyring.Rotate", &args, &out); err != nil {
		return nil, err
	}
	setIndex(resp, out.Index)
	return out, nil
}

func (s *HTTPServer) keyringDeleteRequest(resp http.ResponseWriter, req *http.Request, keyID string, force bool) (any, error) {

	args := structs.KeyringDeleteRootKeyRequest{KeyID: keyID, Force: force}
	s.parseWriteRequest(req, &args.WriteRequest)

	var out structs.KeyringDeleteRootKeyResponse

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Send publish_time as a valid base-10 signed 64-bit integer (Unix timestamp) in the query string
  2. Omit the publish_time parameter entirely if not needed
  3. Check the client is not sending a float, empty string with units, or out-of-range value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at command/agent/keyring_endpoint.go:186 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/1b9d09415a6cf5b2. Report an issue: GitHub.