SigNoz/signoz · error
ErrCodeServiceDefinitionNotFound
ErrCodeServiceDefinitionNotFound
Error message
service definition not found for service id %q
What it means
The cloudintegration definition store reads service definitions from an on-disk directory tree (definitionsRoot/<provider>/<serviceID>) and hydrates them. Get returns this NotFound error when reading or parsing that directory fails — most commonly because no definition exists for the given provider/serviceID pair, or the bundled files are missing/corrupt.
Source
Thrown at pkg/modules/cloudintegration/implcloudintegration/definitionstore.go:36
const definitionsRoot = "fs/definitions"
//go:embed fs/definitions/*
var definitionFiles embed.FS
type definitionStore struct{}
// NewServiceDefinitionStore creates a new ServiceDefinitionStore backed by the embedded filesystem.
func NewServiceDefinitionStore() citypes.ServiceDefinitionStore {
return &definitionStore{}
}
// Get reads and hydrates the service definition for the given provider and service ID.
func (s *definitionStore) Get(ctx context.Context, provider citypes.CloudProviderType, serviceID citypes.ServiceID) (*citypes.ServiceDefinition, error) {
svcDir := path.Join(definitionsRoot, provider.StringValue(), serviceID.StringValue())
def, err := readServiceDefinition(svcDir)
if err != nil {
return nil, errors.New(errors.TypeNotFound, citypes.ErrCodeServiceDefinitionNotFound, fmt.Sprintf("service definition not found for service id %q", serviceID.StringValue()))
}
return def, nil
}
// List reads and hydrates all service definitions for the given provider, sorted by ID.
func (s *definitionStore) List(ctx context.Context, provider citypes.CloudProviderType) ([]*citypes.ServiceDefinition, error) {
providerDir := path.Join(definitionsRoot, provider.StringValue())
entries, err := fs.ReadDir(definitionFiles, providerDir)
if err != nil {
return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't read service definition dirs for %s", provider.StringValue())
}
var result []*citypes.ServiceDefinition
for _, entry := range entries {
if !entry.IsDir() {
continue
}
svcDir := path.Join(providerDir, entry.Name())View on GitHub (pinned to 5069bf80b0)
Solutions
- Verify the serviceID and provider exactly match a directory under definitionsRoot/<provider>/<serviceID>.
- Use List(provider) to enumerate the actually available service definitions and pick a valid ID.
- If the ID should exist, verify the definitions were embedded/staged with the build and re-deploy the correct binary/image.
Example fix
// before
def, err := store.Get(ctx, provider, serviceID) // ErrCodeServiceDefinitionNotFound
// after
defs, err := store.List(ctx, provider)
if err != nil { return err }
for _, d := range defs {
if d.ID == serviceID { def = d; break }
}
if def == nil { return fmt.Errorf("unknown service %q for provider %s", serviceID, provider) } Defensive patterns
Strategy: type-guard
Validate before calling
defs, err := store.List(ctx, provider)
if err != nil {
return err
}
valid := false
for _, d := range defs {
if d.ID.StringValue() == serviceID.StringValue() { valid = true; break }
}
if !valid {
return fmt.Errorf("service %q not defined for provider %s; pick from %d available", serviceID, provider, len(defs))
} Type guard
func serviceExists(ctx context.Context, store cloudintegration.DefinitionStore, p citypes.CloudProviderType, id citypes.ServiceID) bool {
defs, err := store.List(ctx, p)
if err != nil { return false }
for _, d := range defs {
if d.ID == id { return true }
}
return false
} Try / catch
def, err := store.Get(ctx, provider, serviceID)
if err != nil {
if errors.Is(err, citypes.ErrCodeServiceDefinitionNotFound) {
// fall back to List() or surface selectable options to the user
}
return err
} Prevention
- Validate persisted service IDs after upgrades against the current definitions bundle.
- Always derive service IDs from List() output rather than hardcoding strings.
When it happens
Trigger: Calling definitionStore.Get with a serviceID that has no directory under the provider's definitions root; referencing a service ID from a newer/older bundle than the deployed binary; filesystem where definitions are embedded/staged is incomplete.
Common situations: Passing a stale service ID persisted from a previous version after an upgrade; typos or wrong-case service IDs; custom deployments where the definitions directory was not shipped; provider directory name mismatch.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/876d86b2c0f414a0.
Report an issue: GitHub.