micro/go-micro · error
source loading errors: %s
Error message
source loading errors: %s
What it means
The memory config loader's Sync reloads all configured sources; any per-source read errors are collected into gerr and, if non-empty, returned as a single joined error after the snapshot is still applied. It indicates one or more config sources failed to load, with each underlying message on its own line.
Source
Thrown at config/loader/memory/memory.go:268
// set values
vals, err := m.opts.Reader.Values(set)
if err != nil {
m.Unlock()
return err
}
m.vals = vals
m.snap = &loader.Snapshot{
ChangeSet: set,
Version: genVer(),
}
m.Unlock()
// update watchers
m.update()
if len(gerr) > 0 {
return fmt.Errorf("source loading errors: %s", strings.Join(gerr, "\n"))
}
return nil
}
func (m *memory) Close() error {
m.closeMu.Lock()
defer m.closeMu.Unlock()
if m.closed {
return nil
}
close(m.exit)
m.closed = true
return nil
}
View on GitHub (pinned to 24529f1404)
Solutions
- Parse the error string: each line after the prefix is one source's error; fix the underlying source listed
- Check connectivity/credentials for the failing backend and retry Sync
- Make sources resilient or remove/disable the failing source from the loader
- Verify the source's key/path exists and has non-empty content before loading
Example fix
// before
if err := loader.Sync(); err != nil { log.Fatal(err) } // opaque joined error
// after
if err := loader.Sync(); err != nil {
for _, line := range strings.Split(err.Error(), "\n") { log.Warn(line) }
// fall back to last good snapshot
} Defensive patterns
Strategy: try-catch
Validate before calling
// before syncing, sanity-check each source is reachable/readable
for _, s := range sources {
if _, err := s.Read(); err != nil {
log.Warn("source unavailable, will use last good snapshot:", err)
}
} Try / catch
if err := loader.Sync(); err != nil {
for _, line := range strings.Split(err.Error(), "\n") {
log.Error("config source error: ", line)
}
// keep serving last good snapshot; do not crash
} Prevention
- Split the joined error by newlines to identify each failing source
- Keep the last good snapshot and degrade gracefully instead of fatal-ing
- Monitor config backends (file existence, service health) before reloads
- Load config eagerly at startup so source failures surface early
When it happens
Trigger: Calling loader.Sync (directly or via Snapshot/Get on an auto-synced loader) when any source's Read fails — e.g. an unreachable config server, expired credentials, or a malformed remote config.
Common situations: A config backend (file removed, etcd/consul/nats down) becoming unavailable between reloads; bad credentials after rotation; a source added to the loader pointing at a non-existent path or key.
Related errors
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/6ee0aae80d03010d.
Report an issue: GitHub.