kubernetes/kops · error

error coverting MessageRetentionPeriod to int: %v

Error message

error coverting MessageRetentionPeriod to int: %v

What it means

strconv.Atoi failed on the queue's MessageRetentionPeriod attribute — AWS returned a value that is not an integer, so kOps cannot populate the SQS task's comparison field.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/sqs.go:92

		return nil, nil
	}
	if len(response.QueueUrls) != 1 {
		return nil, fmt.Errorf("found multiple SQS queues matching queue name")
	}
	url := response.QueueUrls[0]

	attributes, err := cloud.SQS().GetQueueAttributes(ctx, &sqs.GetQueueAttributesInput{
		AttributeNames: []sqstypes.QueueAttributeName{sqstypes.QueueAttributeNameMessageRetentionPeriod, sqstypes.QueueAttributeNamePolicy, sqstypes.QueueAttributeNameQueueArn},
		QueueUrl:       aws.String(url),
	})
	if err != nil {
		return nil, fmt.Errorf("error getting SQS queue attributes: %v", err)
	}
	actualPolicy := attributes.Attributes["Policy"]
	actualARN := attributes.Attributes["QueueArn"]
	period, err := strconv.Atoi(attributes.Attributes["MessageRetentionPeriod"])
	if err != nil {
		return nil, fmt.Errorf("error coverting MessageRetentionPeriod to int: %v", err)
	}

	tags, err := cloud.SQS().ListQueueTags(ctx, &sqs.ListQueueTagsInput{
		QueueUrl: aws.String(url),
	})
	if err != nil {
		return nil, fmt.Errorf("error listing SQS queue tags: %v", err)
	}

	// We parse both as JSON; if the json forms are equal we pretend the actual value is the expected value
	if q.Policy != nil {
		expectedPolicy, err := fi.ResourceAsString(q.Policy)
		if err != nil {
			return nil, fmt.Errorf("error reading expected Policy for SQS %q: %v", aws.ToString(q.Name), err)
		}
		expectedJson := make(map[string]interface{})
		err = json.Unmarshal([]byte(expectedPolicy), &expectedJson)
		if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the queue's attributes in the AWS console for a corrupted MessageRetentionPeriod
  2. Recreate or fix the queue's attributes so the period is a plain integer (seconds)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/sqs.go:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/c10ceddc36275e5c. Report an issue: GitHub.