{"record":{"id":"af89d07e7210d898","repo":"abiosoft/colima","slug":"error-marshalling-lima-network-config-file-w","errorCode":null,"errorMessage":"error marshalling Lima network config file: %w","messagePattern":"error marshalling Lima network config file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/network.go","lineNumber":52,"sourceCode":"\tgatewayAddress := conf.Network.GatewayAddress\n\tif gatewayAddress != nil {\n\t\tdefaultLimaNetworkConfig.Networks.UserV2.Gateway = gatewayAddress\n\t}\n\n\t// if there are no running instances, clear network directory\n\tif instances, err := limautil.RunningInstances(); err == nil && len(instances) == 0 {\n\t\tif err := os.RemoveAll(limautil.NetworkAssetsDirectory()); err != nil {\n\t\t\tlogrus.Warnln(fmt.Errorf(\"could not clear network assets directory: %w\", err))\n\t\t}\n\t}\n\n\tif err := os.MkdirAll(filepath.Dir(networkFile), 0755); err != nil {\n\t\treturn fmt.Errorf(\"error creating Lima config directory: %w\", err)\n\t}\n\n\tnetworkFileMarshalled, err := yaml.Marshal(&defaultLimaNetworkConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshalling Lima network config file: %w\", err)\n\t}\n\n\tif err := os.WriteFile(networkFile, networkFileMarshalled, 0755); err != nil {\n\t\treturn fmt.Errorf(\"error writing Lima network config file: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (l *limaVM) replicateHostAddresses(conf config.Config) error {\n\tif !conf.Network.Address && conf.Network.HostAddresses {\n\t\tfor _, ip := range util.HostIPAddresses() {\n\t\t\tif err := l.RunQuiet(\"sudo\", \"ip\", \"address\", \"add\", ip.String()+\"/24\", \"dev\", \"lo\"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/network.go#L34-L70","documentation":"Error returned when yaml.Marshal fails to serialize defaultLimaNetworkConfig (the Lima user-v2 network template, including the gateway address) to YAML. For a plain struct of strings this is nearly unreachable; it would require a field value that the YAML encoder rejects.","triggerScenarios":"Marshalling the network config struct with an unserializable field value — practically only via an internal type change or corrupted construction; there is no user-facing knob that feeds raw unserializable data into this struct.","commonSituations":"Almost never seen in the field; if reported, it correlates with a colima build bug or a patched fork where a network field type no longer marshals.","solutions":["Treat as a colima bug: upgrade to the latest release","If reproducible, report with 'colima version' and the full startup log","Workaround: start without network customization (no --network flags) if the issue involves custom network settings"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Structural marshal failure: catch, log the full struct for the bug report, and retry once without custom network fields (defaults) so startup can proceed while the defect is reported upstream.","preventionTips":["Stay on released colima builds; pre-release/fork builds are the only realistic source of this error","Include the network config in any bug report when it fires"],"tags":["yaml","serialization","network","unreachable"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}