{"record":{"id":"abadf8defb83e84f","repo":"gofr-dev/gofr","slug":"status-down-abadf8","errorCode":null,"errorMessage":"status down","messagePattern":"status down","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/gofr/datasource/kv-store/dynamodb/dynamo.go","lineNumber":21,"sourceCode":"import (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/config\"\n\t\"github.com/aws/aws-sdk-go-v2/service/dynamodb\"\n\t\"github.com/aws/aws-sdk-go-v2/service/dynamodb/types\"\n\t\"go.opentelemetry.io/otel/attribute\"\n\t\"go.opentelemetry.io/otel/trace\"\n)\n\nvar (\n\terrClientNotConnected = errors.New(\"client not connected, call Connect() first\")\n\terrKeyNotFound        = errors.New(\"key not found\")\n\terrStatusDown         = errors.New(\"status down\")\n)\n\ntype Configs struct {\n\tTable            string\n\tRegion           string\n\tEndpoint         string\n\tPartitionKeyName string\n}\ntype dynamoDBInterface interface {\n\tPutItem(\n\t\tctx context.Context,\n\t\tparams *dynamodb.PutItemInput,\n\t\toptFns ...func(*dynamodb.Options),\n\t) (*dynamodb.PutItemOutput, error)\n\tGetItem(\n\t\tctx context.Context,\n\t\tparams *dynamodb.GetItemInput,\n\t\toptFns ...func(*dynamodb.Options),","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/gofr-dev/gofr/blob/187eb24962502e91f1fee856230670958b66e89c/pkg/gofr/datasource/kv-store/dynamodb/dynamo.go#L3-L39","documentation":"errStatusDown ('status down') is the sentinel returned by the DynamoDB client's HealthCheck when the datasource fails its health probe (e.g. the AWS DynamoDB client cannot reach the service or an operation check fails). It signals the store is unhealthy, not that a specific key operation failed. Tests reference it to assert error paths.","triggerScenarios":"Calling Client.HealthCheck(ctx) while the AWS credentials/session are invalid, the region/endpoint is wrong, network egress to DynamoDB is blocked, or the underlying DynamoDB client is nil/not connected.","commonSituations":"Misconfigured AWS_REGION or endpoint in dev containers, missing IAM permissions, corporate proxy/firewall blocking AWS endpoints, LocalStack not running when Configs.Endpoint points at it.","solutions":["Fix AWS credentials and region in Configs or environment (AWS_ACCESS_KEY_ID, AWS_REGION, endpoint)","If using a custom Configs.Endpoint, confirm the local emulator (e.g. LocalStack) is running and reachable","Call Connect() and verify connectivity before health checks; inspect the wrapped cause returned alongside status down","Check network egress/IAM policy allows dynamodb operations"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight: verify AWS config resolves\nsess, err := session.NewSession(&aws.Config{Region: aws.String(cfg.Region)})\nif err != nil || sess.Config.Region == nil { return fmt.Errorf(\"invalid AWS config: %w\", err) }","typeGuard":"func IsStatusDown(err error) bool { return errors.Is(err, dynamodb.ErrStatusDown) }","tryCatchPattern":"if err := store.HealthCheck(ctx); err != nil {\n    if errors.Is(err, dynamodb.ErrStatusDown) {\n        return retry.WithBackoff(store.HealthCheck, 5*time.Second)\n    }\n    return err\n}","preventionTips":["Run a health check gate before serving traffic","Pin AWS region and credentials in environment/config validation","Use a local endpoint (LocalStack) in dev and ensure it is up","Alert on repeated HealthCheck failures"],"tags":["dynamodb","health-check","aws","connectivity"],"backgroundTag":"service-health-check-failed","analyzedSha":"187eb24962502e91f1fee856230670958b66e89c","analyzedAt":"2026-09-01T20:34:54.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}