{"record":{"id":"cb6843ca313c9209","repo":"lima-vm/lima","slug":"limactl-network-delete-currently-always-requires","errorCode":null,"errorMessage":"`limactl network delete` currently always requires `--force`","messagePattern":"`limactl network delete` currently always requires `--force`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/network.go","lineNumber":287,"sourceCode":"`,\n\t\tAliases:           []string{\"remove\", \"rm\"},\n\t\tArgs:              WrapArgsError(cobra.MinimumNArgs(1)),\n\t\tRunE:              networkDeleteAction,\n\t\tValidArgsFunction: networkBashComplete,\n\t}\n\tflags := cmd.Flags()\n\tflags.BoolP(\"force\", \"f\", false, \"Force delete (currently always required)\")\n\treturn cmd\n}\n\nfunc networkDeleteAction(cmd *cobra.Command, args []string) error {\n\tflags := cmd.Flags()\n\tforce, err := flags.GetBool(\"force\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !force {\n\t\treturn errors.New(\"`limactl network delete` currently always requires `--force`\")\n\t\t// Because the command currently does not check whether the network being removed is in use\n\t}\n\n\tnetworks := make([]string, len(args))\n\tfor i, name := range args {\n\t\tnetworks[i] = fmt.Sprintf(\"del(.networks.%q)\", name)\n\t}\n\tyq := strings.Join(networks, \" | \")\n\treturn networkApplyYQ(cmd.Context(), yq)\n}\n\nfunc networkBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\treturn bashCompleteNetworkNames(cmd)\n}\n","sourceCodeStart":269,"sourceCodeEnd":302,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/network.go#L269-L302","documentation":"`limactl network delete` performs no in-use check, so deletion is gated behind an explicit --force flag. The command intentionally refuses to run without it (comment in source: it does not verify whether the network is being used by instances).","triggerScenarios":"Running `limactl network delete <name>` without --force.","commonSituations":"Interactive users forgetting the flag; scripts written before the flag became mandatory; aliases/scripts copying the older delete syntax without --force.","solutions":["Add --force: `limactl network delete --force <name>`","Use the -f shorthand: `limactl network rm -f <name>`","First verify no instance references the network (grep instance yaml for the network name), then delete with --force"],"exampleFix":"// before\nlimactl network delete mynet\n// after\nlimactl network delete --force mynet","handlingStrategy":"validation","validationCode":"grep -q \"networks.\" ~/.lima/_config/networks.yaml && echo \"network in use; review instances first\"\nlimactl network delete --force \"$name\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include --force/-f when scripting network delete","Manually confirm no instance references the network before forcing deletion","Treat delete as irreversible; back up networks.yaml first"],"tags":["network","cli","destructive-command"],"backgroundTag":"force-flag-required","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}