{"record":{"id":"82f1eeb0f8de47b4","repo":"crowdsecurity/crowdsec","slug":"timeout-while-waiting-for-consumer-to-be-active","errorCode":null,"errorMessage":"timeout while waiting for consumer to be active: %w","messagePattern":"timeout while waiting for consumer to be active: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/kinesis/run.go","lineNumber":152,"sourceCode":"\t}\n\n\treturn fmt.Errorf(\"consumer %s is not active after %d tries\", consumerARN, maxTries)\n}\n\nfunc (s *Source) RegisterConsumer(ctx context.Context) (*kinesis.RegisterStreamConsumerOutput, error) {\n\ts.logger.Debugf(\"Registering consumer %s\", s.Config.ConsumerName)\n\n\tstreamConsumer, err := s.kClient.RegisterStreamConsumer(ctx, &kinesis.RegisterStreamConsumerInput{\n\t\t\tConsumerName: aws.String(s.Config.ConsumerName),\n\t\t\tStreamARN:    aws.String(s.Config.StreamARN),\n\t\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot register stream consumer: %w\", err)\n\t}\n\n\terr = s.WaitForConsumerRegistration(ctx, *streamConsumer.Consumer.ConsumerARN)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"timeout while waiting for consumer to be active: %w\", err)\n\t}\n\n\treturn streamConsumer, nil\n}\n\nfunc (s *Source) ParseAndPushRecords(records []kinTypes.Record, out chan pipeline.Event, logger *log.Entry, shardID string) {\n\tfor _, record := range records {\n\t\tif s.Config.StreamARN != \"\" {\n\t\t\tif s.metricsLevel != metrics.AcquisitionMetricsLevelNone {\n\t\t\t\tmetrics.KinesisDataSourceLinesReadShards.With(prometheus.Labels{\"stream\": s.Config.StreamARN, \"shard\": shardID}).Inc()\n\t\t\t\tmetrics.KinesisDataSourceLinesRead.With(prometheus.Labels{\"stream\": s.Config.StreamARN, \"datasource_type\": ModuleName, \"acquis_type\": s.Config.Labels[\"type\"]}).Inc()\n\t\t\t}\n\t\t} else {\n\t\t\tif s.metricsLevel != metrics.AcquisitionMetricsLevelNone {\n\t\t\t\tmetrics.KinesisDataSourceLinesReadShards.With(prometheus.Labels{\"stream\": s.Config.StreamName, \"shard\": shardID}).Inc()\n\t\t\t\tmetrics.KinesisDataSourceLinesRead.With(prometheus.Labels{\"stream\": s.Config.StreamName, \"datasource_type\": ModuleName, \"acquis_type\": s.Config.Labels[\"type\"]}).Inc()\n\t\t\t}\n\t\t}","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/kinesis/run.go#L134-L170","documentation":"Returned by RegisterConsumer when registration succeeded but the subsequent WaitForConsumerRegistration poll failed (errors 425/426), wrapped with a timeout-flavored message. EnhancedRead aborts EFO setup at this point.","triggerScenarios":"RegisterStreamConsumer returns 200, then describe polls either error immediately (425) or never see the consumer ACTIVE before maxTries elapses (426).","commonSituations":"Slow consumer activation combined with low max_retries; describe-permission missing; throttling right after registration.","solutions":["Increase `max_retries` in the acquisition config to allow more activation time.","Re-run the acquisition; the consumer already exists and RegisterStreamConsumer/describe will pick up its state.","Check IAM for kinesis:DescribeStreamConsumer and inspect the inner error to distinguish permission/throttle failures from a genuine timeout.","If activation is consistently slow, reduce concurrent consumer churn on the stream."],"exampleFix":"// before\nmax_retries: 2\n// after\nmax_retries: 20","handlingStrategy":"retry","validationCode":"// Ensure describe permission and a large enough retry budget before registering\naws iam simulate-principal-policy --policy-source-arn <role> --action-names kinesis:DescribeStreamConsumer","typeGuard":null,"tryCatchPattern":"consumer, err := registerConsumer(ctx)\nif err != nil {\n    var to *TimeoutError\n    if errors.As(err, &to) {\n        // registration succeeded; consumer may become ACTIVE shortly — safe to retry start\n        return retryAfter(5 * time.Second)\n    }\n    return err\n}","preventionTips":["Raise max_retries so the 200ms-growing backoff spans realistic activation times.","Reuse existing consumers across restarts to skip the activation wait entirely.","Investigate inner errors: permission/throttle failures need IAM or rate fixes, not retries."],"tags":["aws","kinesis","timeout","efo"],"backgroundTag":"request-timeout","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}