thanos-io/thanos · error
unable to unmarshal config content
Error message
unable to unmarshal config content: %s
What it means
Raised when the endpoint config file's YAML (or NDJSON) content was read successfully but yaml.Unmarshal into EndpointConfig fails. Thanos reports the file path alongside the YAML error so the offending field/type can be identified. Parsing is aborted and the endpoint provider is not created.
Solutions
- Validate the YAML syntax with `yamllint` or a quick `yaml.Unmarshal` script; fix indentation/tabs.
- Compare fields against the EndpointConfig schema for your Thanos version (endpoints, endpoint_groups, service_config, etc.); remove unknown or mistyped fields.
- If the file is NDJSON, pass it via the NDJSON flag instead of the YAML flag (they use different parsers).
- Pin/upgrade Thanos so config schema matches your file; check release notes for endpoint config changes.
Example fix
// bad config: unquoted value typed wrong // endpoints: // - address: 127.0.0.1:10901 // static: "yes" // after: correct types // endpoints: // - address: 127.0.0.1:10901 // static: true
Defensive patterns
Strategy: validation
Validate before calling
var probe EndpointConfig
if err := yaml.UnmarshalStrict([]byte(raw), &probe); err != nil { return fmt.Errorf("endpoint config invalid YAML/schema: %w", err) } Try / catch
cfg, err := provider.parse(configFile)
if err != nil {
var yerr *yaml.TypeError
if errors.As(err, &yerr) { log.Fatalf("endpoint config schema error in %s: %v", configFile.Path(), yerr) }
return err
} Prevention
- Lint the YAML with yamllint and validate against the EndpointConfig schema in CI.
- Use yaml.UnmarshalStrict locally to catch unknown/misspelled fields.
- Don't mix NDJSON and YAML formats — use the matching flag for each.
- Re-validate endpoint config after Thanos version upgrades (schema drift).
When it happens
Trigger: configFile.Content() succeeds but the content is not valid YAML, has wrong types for EndpointConfig fields (e.g., string where bool expected), or duplicates keys that the strict unmarshal rejects.
Common situations: Hand-edited endpoint config with a typo or wrong indentation; passing NDJSON where YAML is expected (or vice versa) to the wrong flag; schema drift after Thanos version change adds/renames EndpointConfig fields.
Related errors
- endpoint
- unable to validate endpoints
- query configuration
- failed to parse remote write config
- reloading rules failed
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/c5beb93657a4b34a.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/thanos/endpointset.go:179
}
func (er *endpointConfigProvider) config() EndpointConfig {
er.mu.Lock()
defer er.mu.Unlock()
res := EndpointConfig{Endpoints: make([]endpointSettings, len(er.cfg.Endpoints)), DefaultClientConfig: er.cfg.DefaultClientConfig}
copy(res.Endpoints, er.cfg.Endpoints)
return res
}
func (er *endpointConfigProvider) parse(configFile fileContent) (EndpointConfig, error) {
content, err := configFile.Content()
if err != nil {
return EndpointConfig{}, errors.Wrapf(err, "unable to load config content: %s", configFile.Path())
}
var cfg EndpointConfig
if err := yaml.Unmarshal(content, &cfg); err != nil {
return EndpointConfig{}, errors.Wrapf(err, "unable to unmarshal config content: %s", configFile.Path())
}
return cfg, nil
}
func (er *endpointConfigProvider) addStaticEndpoints(cfg *EndpointConfig) {
for _, e := range er.endpoints {
cfg.Endpoints = append(cfg.Endpoints, endpointSettings{
Address: e,
})
}
for _, e := range er.endpointGroups {
cfg.Endpoints = append(cfg.Endpoints, endpointSettings{
Address: e,
Group: true,
})
}
for _, e := range er.strictEndpoints {
cfg.Endpoints = append(cfg.Endpoints, endpointSettings{View on GitHub (pinned to 35b8b99117)