kubernetes/kops · error
error reading expected Policy for SQS %q: %v
Error message
error reading expected Policy for SQS %q: %v
What it means
fi.ResourceAsString failed reading the expected policy document for the SQS queue task — the policy resource embedded in the model could not be materialized to a string.
Source
Thrown at upup/pkg/fi/cloudup/awstasks/sqs.go:106
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 {
return nil, fmt.Errorf("error parsing expected Policy for SQS %q: %v", aws.ToString(q.Name), err)
}
actualJson := make(map[string]interface{})
err = json.Unmarshal([]byte(actualPolicy), &actualJson)
if err != nil {
return nil, fmt.Errorf("error parsing actual Policy for SQS %q: %v", aws.ToString(q.Name), err)
}
if err := normalizePolicy(expectedJson); err != nil {
return nil, err
}
if err := normalizePolicy(actualJson); err != nil {
return nil, err
}View on GitHub (pinned to 4c8573c808)
Solutions
- Check the policy resource referenced by the SQS spec is a readable literal or template
- Re-run `kops update` after fixing the policy source
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/sqs.go:106 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/78f2d4e493041ece.
Report an issue: GitHub.