{"record":{"id":"3eea77abf1859f53","repo":"crowdsecurity/crowdsec","slug":"starting-crowdsec-daemon-w","errorCode":null,"errorMessage":"starting crowdsec daemon: %w","messagePattern":"starting crowdsec daemon: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/hubtest_item.go","lineNumber":372,"sourceCode":"\tcscliBouncerCmd.Dir = testPath\n\tcscliBouncerCmd.Env = []string{\"TESTDIR=\" + testPath, \"DATADIR=\" + t.RuntimeHubConfig.InstallDataDir, \"TZ=UTC\"}\n\n\toutput, err = cscliBouncerCmd.CombinedOutput()\n\tif err != nil {\n\t\tif !strings.Contains(string(output), \"unable to create bouncer: bouncer appsectests already exists\") {\n\t\t\tfmt.Fprintln(os.Stdout, string(output))\n\t\t\treturn fmt.Errorf(\"fail to run '%s' for test '%s': %w\", cscliRegisterCmd.String(), t.Name, err)\n\t\t}\n\t}\n\n\t// start crowdsec service\n\tcmdArgs = []string{\"-c\", t.RuntimeConfigFilePath}\n\tcrowdsecDaemon := exec.CommandContext(ctx, t.CrowdSecPath, cmdArgs...)\n\tcrowdsecDaemon.Dir = testPath\n\tcrowdsecDaemon.Env = []string{\"TESTDIR=\" + testPath, \"DATADIR=\" + t.RuntimeHubConfig.InstallDataDir, \"TZ=UTC\"}\n\n\tif err := crowdsecDaemon.Start(); err != nil {\n\t\treturn fmt.Errorf(\"starting crowdsec daemon: %w\", err)\n\t}\n\n\t// wait for the appsec port to be available\n\tif _, err = IsAlive(ctx, t.AppSecHost); err != nil {\n\t\tcrowdsecLog, err2 := os.ReadFile(crowdsecLogFile)\n\t\tif err2 != nil {\n\t\t\tlog.Errorf(\"unable to read crowdsec log file '%s': %s\", crowdsecLogFile, err)\n\t\t} else {\n\t\t\tlog.Errorf(\"crowdsec log file '%s'\", crowdsecLogFile)\n\t\t\tlog.Errorf(\"%s\\n\", string(crowdsecLog))\n\t\t}\n\n\t\treturn fmt.Errorf(\"appsec is down: %w\", err)\n\t}\n\n\t// check if the target is available\n\tnucleiTargetParsedURL, err := url.Parse(t.NucleiTargetHost)\n\tif err != nil {","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/hubtest_item.go#L354-L390","documentation":"RunWithNucleiTemplate starts the crowdsec daemon as a child process with the test's config. If the process cannot even be started (Start() fails), the test aborts with this error. It is a process-launch failure, not a crowdsec startup failure.","triggerScenarios":"crowdsecDaemon.Start() fails: t.CrowdSecPath binary missing or not executable, testPath working directory nonexistent, or fork/exec resource errors.","commonSituations":"Built crowdsec binary not present at the expected path (forgot `make build` before running hubtests); test directory removed between steps; running in a restricted container without exec permissions.","solutions":["Build the binaries first (`make build`) so t.CrowdSecPath points at an executable crowdsec","Check the CrowdSecPath is correct and executable (chmod +x / correct test env setup via scripts/test_env.sh)","Verify the test directory (testPath) exists as the daemon's working directory"],"exampleFix":"// before\ncrowdsecDaemon := exec.CommandContext(ctx, t.CrowdSecPath, cmdArgs...)\n// after\n// ensure binary exists before starting:\nif _, err := os.Stat(t.CrowdSecPath); err != nil { return fmt.Errorf(\"crowdsec binary missing at %s: %w\", t.CrowdSecPath, err) }","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(crowdsecPath); err != nil || info.IsDir() || info.Mode()&0o111 == 0 {\n\tt.Fatalf(\"crowdsec binary missing or not executable at %s\", crowdsecPath)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `make build` (or scripts/test_env.sh) before executing hub tests","Verify the crowdsec binary path is executable in CI before the test job"],"tags":["subprocess","crowdsec","test-harness","exec"],"backgroundTag":"command-not-found","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}