{"record":{"id":"78e0fd9997571784","repo":"SigNoz/signoz","slug":"errcodeunsupported","errorCode":"ErrCodeUnsupported","errorMessage":"get connection credentials is not supported","messagePattern":"get connection credentials is not supported","errorType":"error_code","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/modules/cloudintegration/implcloudintegration/module.go","lineNumber":19,"sourceCode":"package implcloudintegration\n\nimport (\n\t\"context\"\n\n\t\"github.com/SigNoz/signoz/pkg/errors\"\n\t\"github.com/SigNoz/signoz/pkg/modules/cloudintegration\"\n\t\"github.com/SigNoz/signoz/pkg/types/cloudintegrationtypes\"\n\t\"github.com/SigNoz/signoz/pkg/valuer\"\n)\n\ntype module struct{}\n\nfunc NewModule() cloudintegration.Module {\n\treturn &module{}\n}\n\nfunc (module *module) GetConnectionCredentials(ctx context.Context, orgID valuer.UUID, provider cloudintegrationtypes.CloudProviderType) (*cloudintegrationtypes.Credentials, error) {\n\treturn nil, errors.New(errors.TypeUnsupported, cloudintegrationtypes.ErrCodeUnsupported, \"get connection credentials is not supported\")\n}\n\nfunc (module *module) CreateAccount(ctx context.Context, account *cloudintegrationtypes.Account) error {\n\treturn errors.New(errors.TypeUnsupported, cloudintegrationtypes.ErrCodeUnsupported, \"create account is not supported\")\n}\n\nfunc (module *module) GetAccount(ctx context.Context, orgID valuer.UUID, accountID valuer.UUID, provider cloudintegrationtypes.CloudProviderType) (*cloudintegrationtypes.Account, error) {\n\treturn nil, errors.New(errors.TypeUnsupported, cloudintegrationtypes.ErrCodeUnsupported, \"get account is not supported\")\n}\n\n// GetConnectedAccount implements [cloudintegration.Module].\nfunc (module *module) GetConnectedAccount(ctx context.Context, orgID valuer.UUID, accountID valuer.UUID, provider cloudintegrationtypes.CloudProviderType) (*cloudintegrationtypes.Account, error) {\n\treturn nil, errors.New(errors.TypeUnsupported, cloudintegrationtypes.ErrCodeUnsupported, \"get connected account is not supported\")\n}\n\nfunc (module *module) ListAccounts(ctx context.Context, orgID valuer.UUID, provider cloudintegrationtypes.CloudProviderType) ([]*cloudintegrationtypes.Account, error) {\n\treturn nil, errors.New(errors.TypeUnsupported, cloudintegrationtypes.ErrCodeUnsupported, \"list accounts is not supported\")\n}","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/modules/cloudintegration/implcloudintegration/module.go#L1-L37","documentation":"The base cloudintegration module deliberately implements the Module interface's optional account/credential operations as unsupported stubs. GetConnectionCredentials always returns this TypeUnsupported error; only provider-specific modules that embed and override it provide real credentials.","triggerScenarios":"Calling Module.GetConnectionCredentials on the generic/base cloudintegration module (or a provider module that did not override it) instead of a concrete provider implementation (AWS/Azure/GCP etc.).","commonSituations":"Wiring the interface with the default NewModule() instead of the provider-specific constructor; adding a new cloud provider whose module forgot to implement credentials; DI misconfiguration resolving the base module.","solutions":["Resolve and use the provider-specific cloudintegration module that implements GetConnectionCredentials.","If you are implementing a new provider module, override GetConnectionCredentials (embed the base module and provide the method).","Feature-detect support before calling (see defense) instead of assuming every module supports it."],"exampleFix":"// before\nm := implcloudintegration.NewModule()\ncreds, err := m.GetConnectionCredentials(ctx, orgID, provider) // ErrCodeUnsupported\n\n// after\ntype credentialsProvider interface {\n    GetConnectionCredentials(context.Context, valuer.UUID, cloudintegrationtypes.CloudProviderType) (*cloudintegrationtypes.Credentials, error)\n}\nif cp, ok := module.(credentialsProvider); ok {\n    creds, err = cp.GetConnectionCredentials(ctx, orgID, provider)\n}","handlingStrategy":"type-guard","validationCode":"type canGetCredentials interface {\n    GetConnectionCredentials(context.Context, valuer.UUID, cloudintegrationtypes.CloudProviderType) (*cloudintegrationtypes.Credentials, error)\n}\nif _, ok := module.(canGetCredentials); !ok {\n    return nil, fmt.Errorf(\"module does not support credentials lookup\")\n}\ncreds, err := module.(canGetCredentials).GetConnectionCredentials(ctx, orgID, provider)","typeGuard":"func supportsCredentials(m cloudintegration.Module) bool {\n    _, ok := m.(interface {\n        GetConnectionCredentials(context.Context, valuer.UUID, cloudintegrationtypes.CloudProviderType) (*cloudintegrationtypes.Credentials, error)\n    })\n    return ok && !isBaseModule(m)\n}","tryCatchPattern":"creds, err := module.GetConnectionCredentials(ctx, orgID, provider)\nif err != nil {\n    if errors.Is(err, cloudintegrationtypes.ErrCodeUnsupported) {\n        return nil, fmt.Errorf(\"credentials not supported for provider %s\", provider)\n    }\n    return nil, err\n}","preventionTips":["Register provider-specific modules, never the base NewModule(), in DI for account flows.","Treat ErrCodeUnsupported as a capability signal and degrade gracefully."],"tags":["cloudintegration","unsupported-operation","interface-stub","credentials"],"backgroundTag":"unsupported-operation","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}