{"record":{"id":"876d86b2c0f414a0","repo":"SigNoz/signoz","slug":"errcodeservicedefinitionnotfound","errorCode":"ErrCodeServiceDefinitionNotFound","errorMessage":"service definition not found for service id %q","messagePattern":"service definition not found for service id %q","errorType":"error_code","errorClass":null,"httpStatus":404,"severity":"error","filePath":"pkg/modules/cloudintegration/implcloudintegration/definitionstore.go","lineNumber":36,"sourceCode":"\nconst definitionsRoot = \"fs/definitions\"\n\n//go:embed fs/definitions/*\nvar definitionFiles embed.FS\n\ntype definitionStore struct{}\n\n// NewServiceDefinitionStore creates a new ServiceDefinitionStore backed by the embedded filesystem.\nfunc NewServiceDefinitionStore() citypes.ServiceDefinitionStore {\n\treturn &definitionStore{}\n}\n\n// Get reads and hydrates the service definition for the given provider and service ID.\nfunc (s *definitionStore) Get(ctx context.Context, provider citypes.CloudProviderType, serviceID citypes.ServiceID) (*citypes.ServiceDefinition, error) {\n\tsvcDir := path.Join(definitionsRoot, provider.StringValue(), serviceID.StringValue())\n\tdef, err := readServiceDefinition(svcDir)\n\tif err != nil {\n\t\treturn nil, errors.New(errors.TypeNotFound, citypes.ErrCodeServiceDefinitionNotFound, fmt.Sprintf(\"service definition not found for service id %q\", serviceID.StringValue()))\n\t}\n\treturn def, nil\n}\n\n// List reads and hydrates all service definitions for the given provider, sorted by ID.\nfunc (s *definitionStore) List(ctx context.Context, provider citypes.CloudProviderType) ([]*citypes.ServiceDefinition, error) {\n\tproviderDir := path.Join(definitionsRoot, provider.StringValue())\n\tentries, err := fs.ReadDir(definitionFiles, providerDir)\n\tif err != nil {\n\t\treturn nil, errors.WrapInternalf(err, errors.CodeInternal, \"couldn't read service definition dirs for %s\", provider.StringValue())\n\t}\n\n\tvar result []*citypes.ServiceDefinition\n\tfor _, entry := range entries {\n\t\tif !entry.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tsvcDir := path.Join(providerDir, entry.Name())","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/modules/cloudintegration/implcloudintegration/definitionstore.go#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ndef, err := store.Get(ctx, provider, serviceID) // ErrCodeServiceDefinitionNotFound\n\n// after\ndefs, err := store.List(ctx, provider)\nif err != nil { return err }\nfor _, d := range defs {\n    if d.ID == serviceID { def = d; break }\n}\nif def == nil { return fmt.Errorf(\"unknown service %q for provider %s\", serviceID, provider) }","handlingStrategy":"type-guard","validationCode":"defs, err := store.List(ctx, provider)\nif err != nil {\n    return err\n}\nvalid := false\nfor _, d := range defs {\n    if d.ID.StringValue() == serviceID.StringValue() { valid = true; break }\n}\nif !valid {\n    return fmt.Errorf(\"service %q not defined for provider %s; pick from %d available\", serviceID, provider, len(defs))\n}","typeGuard":"func serviceExists(ctx context.Context, store cloudintegration.DefinitionStore, p citypes.CloudProviderType, id citypes.ServiceID) bool {\n    defs, err := store.List(ctx, p)\n    if err != nil { return false }\n    for _, d := range defs {\n        if d.ID == id { return true }\n    }\n    return false\n}","tryCatchPattern":"def, err := store.Get(ctx, provider, serviceID)\nif err != nil {\n    if errors.Is(err, citypes.ErrCodeServiceDefinitionNotFound) {\n        // fall back to List() or surface selectable options to the user\n    }\n    return err\n}","preventionTips":["Validate persisted service IDs after upgrades against the current definitions bundle.","Always derive service IDs from List() output rather than hardcoding strings."],"tags":["cloudintegration","service-definition","not-found","filesystem"],"backgroundTag":"resource-not-found","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}