{"record":{"id":"ff728a8bc38523b4","repo":"crowdsecurity/crowdsec","slug":"unable-to-write-overrides-to-s-w","errorCode":null,"errorMessage":"unable to write overrides to '%s': %w","messagePattern":"unable to write overrides to '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/hubtest_item.go","lineNumber":226,"sourceCode":"\tif err := t.installHubItems(t.Config.AppsecRules, t.installAppsecRule); err != nil {\n\t\treturn err\n\t}\n\n\tif len(t.Config.OverrideStatics) > 0 {\n\t\tcfg := parser.NodeConfig{\n\t\t\tName:    \"overrides\",\n\t\t\tFilter:  \"1==1\",\n\t\t\tStatics: t.Config.OverrideStatics,\n\t\t}\n\n\t\tb, err := yaml.Marshal(cfg)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to serialize overrides: %w\", err)\n\t\t}\n\n\t\ttgtFilename := fmt.Sprintf(\"%s/parsers/s00-raw/00_overrides.yaml\", t.RuntimePath)\n\t\tif err := os.WriteFile(tgtFilename, b, os.ModePerm); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to write overrides to '%s': %w\", tgtFilename, err)\n\t\t}\n\t}\n\n\t// load installed hub\n\thub, err := cwhub.NewHub(t.RuntimeHubConfig, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := hub.Load(); err != nil {\n\t\treturn err\n\t}\n\n\t// prevent concurrent downloads of the same file\n\tdownloadMutex.Lock()\n\tdefer downloadMutex.Unlock()\n\n\t// install data for parsers if needed","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/hubtest_item.go#L208-L244","documentation":"After successfully marshaling the override statics, InstallHub writes them to <RuntimePath>/parsers/s00-raw/00_overrides.yaml. If os.WriteFile fails, the error is wrapped as 'unable to write overrides to <path>: %w' so the destination path is included. This indicates a filesystem-level problem in the test runtime directory.","triggerScenarios":"HubTestItem.Run -> InstallHub with a runtime directory that does not exist, is read-only, or lacks write permissions — os.WriteFile cannot create/replace 00_overrides.yaml.","commonSituations":"RuntimePath on a read-only volume or tmpfs that filled up; the runtime environment was cleaned (parsers/s00-raw removed) before the override step; running under a different user (Docker root vs host user) without write permission; disk quota exceeded.","solutions":["Check the wrapped error: EACCES -> fix permissions (chmod/chown the runtime dir); ENOENT -> ensure the runtime environment was initialized; ENOSPC -> free disk space.","Recreate the runtime environment directory (`mkdir -p <RuntimePath>/parsers/s00-raw`) and ensure the process user can write to it.","Re-run test setup (e.g. the code path that creates the runtime environment) before calling Run."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"target := filepath.Join(runtimePath, \"parsers\", \"s00-raw\")\nif err := os.MkdirAll(target, 0o755); err != nil {\n    return err\n}\nif f, err := os.CreateTemp(target, \".probe\"); err != nil {\n    return fmt.Errorf(\"runtime dir not writable: %w\", err)\n} else { f.Close(); os.Remove(f.Name()) }","typeGuard":null,"tryCatchPattern":"err := item.Run(ctx)\nif err != nil && strings.Contains(err.Error(), \"unable to write overrides\") {\n    os.MkdirAll(filepath.Join(item.RuntimePath, \"parsers\", \"s00-raw\"), 0o755)\n    // retry or report FS problem (permissions/disk full)\n}","preventionTips":["Initialize the runtime environment (which creates parsers/s00-raw) before Run.","Run tests as a user with write access to the runtime directory.","Watch for ENOSPC: keep disk headroom in CI runners."],"tags":["filesystem","hubtest","write"],"backgroundTag":"file-write-failed","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}