jaegertracing/jaeger · error

unrecognized UI config file format, expecting .js or .json f

Error message

unrecognized UI config file format, expecting .js or .json file: %v

What it means

loadUIConfig dispatches on the file extension and only understands .json and .js (case-insensitive). Any other extension — .yaml, .yml, .conf, .txt, or no extension — hits the default branch and is rejected. Jaeger intentionally does not sniff content; the extension decides the parser.

Source

Thrown at cmd/jaeger/internal/extension/jaegerquery/internal/static_handler.go:244

		r, _ = json.Marshal(c)

		return &loadedConfig{
			regexp: configPattern,
			config: append([]byte("JAEGER_CONFIG = "), append(r, byte(';'))...),
		}, nil
	case ".js":
		r = bytes.TrimSpace(bytesConfig)
		re := regexp.MustCompile(`function\s+UIConfig(\s)?\(\s?\)(\s)?{`)
		if !re.Match(r) {
			return nil, fmt.Errorf("UI config file must define function UIConfig(): %v", uiConfig)
		}

		return &loadedConfig{
			regexp: configJsPattern,
			config: r,
		}, nil
	default:
		return nil, fmt.Errorf("unrecognized UI config file format, expecting .js or .json file: %v", uiConfig)
	}
}

func (h *staticAssetsHandler) loggingHandler(handler http.Handler) http.Handler {
	if !h.logAccess {
		return handler
	}
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		h.logger.Info("serving static asset", zap.Stringer("url", r.URL))
		handler.ServeHTTP(w, r)
	})
}

func (h *staticAssetsHandler) registerRoutes(router *http.ServeMux) {
	basePath := h.basePath
	if basePath == "" {
		basePath = "/"
	}

View on GitHub (pinned to 806f444784)

Solutions

  1. Rename/convert the config to .json (strict JSON) or .js (must define function UIConfig()).
  2. Update the --query.ui-config flag to point at the file with the correct extension.
  3. If your config is YAML, convert it to JSON first (yq -o=json).
  4. If no UI customization is needed, drop the flag.

Example fix

// before
--query.ui-config=/etc/jaeger/ui-config.yaml
// after
--query.ui-config=/etc/jaeger/ui-config.json
Defensive patterns

Strategy: validation

Validate before calling

ext := strings.ToLower(filepath.Ext(path))
if ext != ".json" && ext != ".js" {
    return fmt.Errorf("ui config must be .json or .js, got %q", ext)
}

Prevention

When it happens

Trigger: loadUIConfig (via newStaticAssetsHandler or the extension config path) receives a uiConfig path whose filepath.Ext is not .json or .js, e.g. --query.ui-config=/etc/jaeger/ui-config.yaml.

Common situations: Reusing an existing YAML/properties config file for the UI base config; omitting the extension entirely; following a guide that used a different naming convention.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/e7c866f7598983f4. Report an issue: GitHub.