kubernetes/kops · error
expected slice at %q, got %T
Error message
expected slice at %q, got %T
What it means
JSONObject.Slice found the key present in the SQS policy document but holding a non-array value; during policy normalization kOps expected a JSON array at that position (e.g. Statement/Action) and got another type.
Source
Thrown at upup/pkg/fi/cloudup/awstasks/sqs.go:159
Tags: intersectSQSTags(tags.Tags, q.Tags),
}
// Avoid flapping
q.ARN = actual.ARN
return actual, nil
}
type JSONObject map[string]any
func (j *JSONObject) Slice(key string) ([]any, bool, error) {
v, found := (*j)[key]
if !found {
return nil, false, nil
}
s, ok := v.([]any)
if !ok {
return nil, false, fmt.Errorf("expected slice at %q, got %T", key, v)
}
return s, true, nil
}
func (j *JSONObject) Object(key string) (JSONObject, bool, error) {
v, found := (*j)[key]
if !found {
return nil, false, nil
}
m, ok := v.(JSONObject)
if !ok {
return nil, false, fmt.Errorf("expected object at %q, got %T", key, v)
}
return m, true, nil
}
// normalizePolicy sorts the Service principals in the policy, so that we can compare policies more easily.
func normalizePolicy(policy map[string]interface{}) error {View on GitHub (pinned to 4c8573c808)
Solutions
- Fix the policy document so the referenced key is a JSON array (e.g. "Action": [ ... ])
- Ensure Statement blocks follow the expected IAM policy structure
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/sqs.go:159 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/089710c6fd0e4ddc.
Report an issue: GitHub.