t8y2/dbx · warning

not JSON

Error message

not JSON

What it means

endpointFromRegistrationJSON expects each HiveServer2 ZooKeeper registration payload to be a JSON object; if json.Unmarshal fails, the payload is not JSON and discovery discards the node with this error. Hive versions register either JSON service records or legacy host:port strings, so non-JSON payloads take the legacy path instead.

Source

Thrown at agents/drivers/hive-go/discovery.go:249

			}
		}
		if value, err := endpointFromPublishedHiveConfig(parameters); err == nil {
			return value, nil
		}
		if strings.Contains(candidate, "=") {
			continue
		}
		if value, err := parseRegisteredEndpoint(candidate); err == nil {
			return value, nil
		}
	}
	return endpoint{}, fmt.Errorf("unsupported HiveServer2 ZooKeeper registration %q", child)
}

func endpointFromRegistrationJSON(value string) (endpoint, error) {
	var object map[string]any
	if json.Unmarshal([]byte(value), &object) != nil {
		return endpoint{}, errors.New("not JSON")
	}
	for _, key := range []string{"serverUri", "server_uri", "hiveServer2Uri", "uri"} {
		if raw, ok := object[key].(string); ok && strings.TrimSpace(raw) != "" {
			return parseRegisteredEndpoint(raw)
		}
	}
	if serviceRecordEndpoint, ok := endpointFromServiceRecord(object); ok {
		return serviceRecordEndpoint, nil
	}
	host, _ := object["host"].(string)
	if host == "" {
		host, _ = object["hostname"].(string)
	}
	port := 0
	switch value := object["port"].(type) {
	case float64:
		port = int(value)
	case string:

View on GitHub (pinned to c0390bff16)

Solutions

  1. Inspect znode data with zkCli (get /hiveserver2/<node>) and remove garbage nodes
  2. Ensure only HiveServer2 instances write to the discovery path
  3. Point discovery at the correct znode; legacy host:port registrations should go through the legacy parser
  4. Re-register/restart HiveServer2 to rewrite a clean registration record

Example fix

// before
zk.Create("/hiveserver2/manual", []byte("not json at all"), ...)
// after
zk.Create("/hiveserver2/manual", []byte(`{"serverUri":"host:10000"}`), ...)
Defensive patterns

Strategy: validation

Validate before calling

func looksLikeJSON(data []byte) bool {
    trimmed := bytes.TrimSpace(data)
    return len(trimmed) > 0 && (trimmed[0] == '{' || trimmed[0] == '[')
}
// only route JSON-looking registrations to endpointFromRegistrationJSON

Try / catch

endpoint, err := parseHiveServerRegistration(child, data)
if err != nil && err.Error() == "not JSON" {
    log.Printf("skipping non-JSON registration %q", child)
    return nil // skip node instead of failing discovery
}

Prevention

When it happens

Trigger: parseHiveServerRegistration encountered a znode child whose data is neither valid JSON nor handled by the legacy parser — corrupted znode data, whitespace/garbage bytes, or a non-Hive node written into the discovery path.

Common situations: Foreign tools writing to /hiveserver2, Hive registered with a plain host:port string while the JSON parser was chosen, binary or truncated znode data after an ensemble crash, testing with handcrafted znode data.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/9ac53ee2405f6bce. Report an issue: GitHub.