{"record":{"id":"c765867c31d3798c","repo":"kubernetes/kops","slug":"error-dumping-q-v","errorCode":null,"errorMessage":"error dumping %q: %v","messagePattern":"error dumping %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/dump.go","lineNumber":60,"sourceCode":"\n// BuildDump gathers information about the cluster and returns an object for dumping\nfunc BuildDump(ctx context.Context, cloud fi.Cloud, resources map[string]*Resource) (*Dump, error) {\n\tdump := &Dump{}\n\top := &DumpOperation{\n\t\tContext: ctx,\n\t\tCloud:   cloud,\n\t\tDump:    dump,\n\t}\n\n\tfor k, r := range resources {\n\t\tif r.Dumper == nil {\n\t\t\tklog.V(8).Infof(\"skipping dump of %q (does not have Dumper)\", k)\n\t\t\tcontinue\n\t\t}\n\n\t\terr := r.Dumper(op, r)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error dumping %q: %v\", k, err)\n\t\t}\n\t}\n\n\tsort.SliceStable(dump.Instances, func(i, j int) bool { return dump.Instances[i].Name < dump.Instances[j].Name })\n\n\treturn dump, nil\n}\n","sourceCodeStart":42,"sourceCodeEnd":68,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/dump.go#L42-L68","documentation":"BuildDump iterates registered resource dumpers and calls each resource's Dumper function; if any dumper returns an error the whole dump fails with 'error dumping %q: %v', where %q is the resource type key. It is a wrapper that aggregates per-resource dump failures (SSH failures, API errors inside the provider dumper, etc.) produced during 'kops toolbox dump'.","triggerScenarios":"Any registered dumper (e.g. instance, VPC, load balancer dumpers) returns non-nil: SSH to a node fails, cloud API listing fails inside the dumper, or the resource object is in an unexpected state (e.g. instance has no resolvable address).","commonSituations":"'kops toolbox dump <cluster>' run when a node is unhealthy/shut down (SSH unreachable), cloud credentials expired so the provider dumper's API calls fail, or partially deleted cluster leaving dangling resources.","solutions":["Read the wrapped %v message to identify which resource type (k) and underlying cause failed; address that specific cause.","Re-run toolbox dump with -v8 logging to see which resource is being processed when it fails.","Fix connectivity/credentials for the failing resource type (SSH keys/bastion for nodes, cloud API creds for provider dumpers).","If a single broken resource blocks the dump, delete or repair that resource in the cloud console, then retry."],"exampleFix":"// before\nerr := r.Dumper(op, r)\nif err != nil {\n\treturn nil, fmt.Errorf(\"error dumping %q: %v\", k, err)\n}\n// after\nerr := r.Dumper(op, r)\nif err != nil {\n\treturn nil, fmt.Errorf(\"error dumping %q: %w\", k, err)\n}","handlingStrategy":"try-catch","validationCode":"// before dumping, confirm each registered resource has a dumper and the cluster is reachable\nfor k, r := range resources {\n\tif r.Dumper == nil {\n\t\tklog.V(8).Infof(\"skipping %q: no dumper\", k)\n\t}\n}","typeGuard":"func hasDumper(r *resources.Resource) bool { return r != nil && r.Dumper != nil }","tryCatchPattern":"dump, err := resources.BuildDump(op, cluster)\nif err != nil {\n\tklog.Errorf(\"toolbox dump failed: %v\", err)\n\t// parse which resource key failed and address that resource (SSH/API) before retrying\n\treturn err\n}","preventionTips":["Ensure nodes are running and SSH (bastion/key) access works before toolbox dump","Validate cloud credentials before dumping","Remove or repair dangling resources from partially deleted clusters","Run with -v8 to trace which resource the dumper is processing"],"tags":["dump","toolbox","debugging"],"backgroundTag":"resource-dump-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}