{"record":{"id":"685a10801e7581d3","repo":"lima-vm/lima","slug":"invalid-boot-script-filename-q-must-be-in-forma","errorCode":null,"errorMessage":"invalid boot script filename %#q: must be in format 'boot.<OS>/<SCRIPT>'","messagePattern":"invalid boot script filename %#q: must be in format 'boot\\.<OS>/<SCRIPT>'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cidata/cidata.go","lineNumber":423,"sourceCode":"\t\treturn \"\", err\n\t}\n\n\tlayout, err := ExecuteTemplateCIDataISO(args)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdriverScripts, err := drv.BootScripts(ctx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get boot scripts: %w\", err)\n\t}\n\n\tfor filename, content := range driverScripts {\n\t\tlayoutPath := path.Join(\"boot.Linux\", filename)\n\t\tif strings.Contains(filename, \"/\") {\n\t\t\t// When the filename contains a slash, it must be in the format of \"boot.<OS>/<SCRIPT>\"\n\t\t\tif !strings.HasPrefix(filename, \"boot.\") || strings.Count(filename, \"/\") != 1 {\n\t\t\t\treturn \"\", fmt.Errorf(\"invalid boot script filename %#q: must be in format 'boot.<OS>/<SCRIPT>'\", filename)\n\t\t\t}\n\t\t\tlayoutPath = filename\n\t\t} else {\n\t\t\tlogrus.Warnf(\"Boot script filename %#q does not contain '/', treating it as a script for Linux and prefixing with 'boot.Linux/'\", filename)\n\t\t}\n\t\tlayout = append(layout, iso9660util.Entry{\n\t\t\tPath:   layoutPath,\n\t\t\tReader: strings.NewReader(string(content)),\n\t\t})\n\t}\n\n\tlayout, err = appendProvisionEntries(layout, instConfig.Provision)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif guestAgentBinary != \"\" {\n\t\tvar guestAgent io.ReadCloser","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/cidata/cidata.go#L405-L441","documentation":"GenerateISO9660 (pkg/cidata/cidata.go:423) validates driver boot script filenames: if a filename contains '/', it must match 'boot.<OS>/<SCRIPT>' (start with 'boot.' and contain exactly one slash). Drivers returning a malformed slash-containing filename make ISO layout construction abort with this error.","triggerScenarios":"A driver's BootScripts() returns a filename like \"boot/win10.cmd\" (missing dot), \"boot.Linux/a/b.sh\" (two slashes), or \"scripts/boot.sh\" (no boot. prefix) while containing '/'.","commonSituations":"Developing a custom driver or upgrading Lima where a driver emits a new script path that no longer matches the expected layout convention.","solutions":["Inspect the driver's BootScripts() return values","Rename the script to the `boot.<OS>/<SCRIPT>` form, e.g. \"boot.Linux/01-setup.sh\"","Ensure the filename contains exactly one '/' and starts with \"boot.\""],"exampleFix":"// before\nreturn map[string]string{\"scripts/setup.sh\": content}, nil\n// after\nreturn map[string]string{\"boot.Linux/setup.sh\": content}, nil","handlingStrategy":"validation","validationCode":"func validBootScriptName(name string) bool {\n    if !strings.Contains(name, \"/\") {\n        return true // will be prefixed with boot.Linux/\n    }\n    return strings.HasPrefix(name, \"boot.\") && strings.Count(name, \"/\") == 1\n}\n// check each filename returned by drv.BootScripts(ctx) before use","typeGuard":null,"tryCatchPattern":"layout, err := cidata.GenerateISO9660(ctx, instDir, args)\nif err != nil && strings.Contains(err.Error(), \"invalid boot script filename\") {\n    log.Fatalf(\"driver returned malformed boot script name: %v\", err)\n}","preventionTips":["When writing drivers, always name boot scripts \"boot.<OS>/<SCRIPT>\" with exactly one slash","Filenames without a slash are safe (auto-prefixed with boot.Linux/)","Add a unit test for custom drivers asserting BootScripts filename format"],"tags":["boot-scripts","filename-validation","driver","iso-generation"],"backgroundTag":"invalid-filename-format","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}