{"record":{"id":"c14c235f08442384","repo":"k3s-io/k3s","slug":"failed-to-get-crds-from-s-v","errorCode":null,"errorMessage":"failed to get CRDs from %s: %v","messagePattern":"failed to get CRDs from (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/server/context.go","lineNumber":109,"sourceCode":"\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}\n\ntype crdLister func() ([]*apiextv1.CustomResourceDefinition, error)\n\nfunc (c *Context) registerCRDs(ctx context.Context) error {\n\tlisters := []crdLister{k3scrds.List}\n\tif c.Helm != nil {\n\t\tlisters = append(listers, helmcrds.List)\n\t}\n\n\tcrds := []*apiextv1.CustomResourceDefinition{}\n\tfor _, list := range listers {\n\t\tl, err := list()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get CRDs from %s: %v\", util.GetFunctionName(list), err)\n\t\t}\n\t\tcrds = append(crds, l...)\n\t}\n\n\treturn retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\treturn crd.BatchCreateCRDs(ctx, c.Ext.ApiextensionsV1().CustomResourceDefinitions(), nil, time.Minute, crds)\n\t})\n}\n","sourceCodeStart":91,"sourceCodeEnd":118,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/server/context.go#L91-L118","documentation":"During server startup, k3s collects the CustomResourceDefinitions it must install: the built-in k3s CRD set (k3scrds.List) plus the helm-controller CRDs (helmcrds.List) when the embedded Helm controller is enabled. Each lister reads embedded YAML manifests and parses them into apiextv1 CRD objects; if a lister fails, the wrapped error identifies the failing lister via util.GetFunctionName. This error aborts CRD registration and therefore server bootstrapping.","triggerScenarios":"Server startup calling registerCRDs (pkg/server/context.go) where either k3scrds.List or helmcrds.List returns an error: an embedded YAML manifest is missing from the build, fails to decode into apiextv1.CustomResourceDefinition, or the embedded assets FS cannot be read. It cannot be triggered by user configuration; it indicates the binary's embedded CRD payload is broken or the binary was corrupted/modified.","commonSituations":"A truncated or bit-flipped k3s binary (partial download, bad transfer over an unstable link), a from-source build where the generated CRD manifests were not embedded (make generate/build skipped), or running an unsupported patched binary. Typically reproduces on every restart of the same node.","solutions":["Verify the k3s binary integrity: re-download the exact release from GitHub and compare its sha256 checksum against the published checksums file.","If built from source, run the full generate/build targets so embedded CRD assets (k3scrds, helmcrds) are regenerated, then rebuild.","Restart the server after replacing the binary to confirm registerCRDs succeeds and CRDs appear via kubectl get crd.","If the error persists on an official, checksum-verified binary, capture 'kubectl get crd' output and the full log and open an issue at github.com/k3s-io/k3s."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// In Go code embedding k3s server startup:\nif err := ctx.registerCRDs(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to get CRDs from\") {\n        log.Fatal(\"embedded CRD assets corrupt - verify binary checksum\")\n    }\n    return err\n}","preventionTips":["Pin k3s releases by digest and checksum-verify every downloaded binary before deployment","Automate binary integrity checks (sha256) in provisioning pipelines","Avoid modifying or stripping k3s binaries after download"],"tags":["kubernetes","crd","startup","embedded-assets"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}