{"record":{"id":"982d0b6daef40a45","repo":"abiosoft/colima","slug":"error-parsing-incus-config-template-w","errorCode":null,"errorMessage":"error parsing incus config template: %w","messagePattern":"error parsing incus config template: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/container/incus/incus.go","lineNumber":110,"sourceCode":"\t\t// previous disk exists\n\t\t// ignore storage, recovery would be attempted later\n\t\trecoverStorage = cli.Prompt(\"existing Incus data found, would you like to recover the storage pool(s)\")\n\t}\n\n\tvar value struct {\n\t\tDisk          int\n\t\tInterface     string\n\t\tBridgeGateway string\n\t\tSetStorage    bool\n\t}\n\tvalue.Disk = conf.Disk\n\tvalue.Interface = incusBridgeInterface\n\tvalue.BridgeGateway = bridgeGateway\n\tvalue.SetStorage = emptyDisk // set only when the disk is empty\n\n\tbuf, err := util.ParseTemplate(configYaml, value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing incus config template: %w\", err)\n\t}\n\n\tstdin := bytes.NewReader(buf)\n\tif err := c.guest.RunWith(stdin, nil, \"sudo\", \"incus\", \"admin\", \"init\", \"--preseed\"); err != nil {\n\t\treturn fmt.Errorf(\"error setting up incus: %w\", err)\n\t}\n\n\t// provision successful\n\tif emptyDisk {\n\t\treturn nil\n\t}\n\n\tif !recoverStorage {\n\t\treturn c.wipeDisk(conf.Disk)\n\t}\n\n\tif _, err := c.guest.Stat(poolDiskFile); err != nil {\n\t\tlog.Warnln(fmt.Errorf(\"cannot recover disk: %w, creating new storage pool\", err))","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/container/incus/incus.go#L92-L128","documentation":"Colima renders the embedded config.yaml preseed for 'incus admin init --preseed' with util.ParseTemplate (Go text/template), and template execution failed. Because both template and value struct ship with colima, this is almost always a build/version mismatch or a malformed embedded asset, not a runtime condition.","triggerScenarios":"ParseTemplate(configYaml, value) returns an error: a template field is missing from the anonymous value struct (Disk, Interface, BridgeGateway, SetStorage), the embedded config.yaml is corrupt, or a mixed-version binary/embedded files.","commonSituations":"Building colima from a partial/dirty checkout where embedded files were not updated, or a version skew between the binary and embedded config.yaml after an interrupted upgrade.","solutions":["Reinstall/upgrade colima to a released version matching its embedded assets","If building from source, do a clean rebuild: 'go clean -cache && go build ./...'","Run 'colima version' and report the mismatch if it persists — this is an internal bug, not a config error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// fail fast if embedded template and struct disagree (build sanity check)\nif _, err := util.ParseTemplate(configYaml, struct {\n    Disk int; Interface, BridgeGateway string; SetStorage bool\n}{}); err != nil {\n    return fmt.Errorf(\"embedded preseed template broken, rebuild colima: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"buf, err := util.ParseTemplate(configYaml, value)\nif err != nil {\n    return fmt.Errorf(\"error parsing incus config template: %w\", err)\n    // not retryable: template and binary ship together; reinstall a matching release\n}","preventionTips":["Use released colima binaries or clean source builds","In CI, add a unit test that renders configYaml with a zero value struct","Keep embedded assets and code in the same commit"],"tags":["incus","template","build","provisioning"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}