{"record":{"id":"93abfd565a463518","repo":"crowdsecurity/crowdsec","slug":"unable-to-install-hub-in-s-w","errorCode":null,"errorMessage":"unable to install hub in '%s': %w","messagePattern":"unable to install hub in '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/hubtest_item.go","lineNumber":664,"sourceCode":"\n\t\tif err = Copy(t.TemplateAcquisPath, t.RuntimeAcquisFilePath); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to copy '%s' to '%s': %w\", t.TemplateAcquisPath, t.RuntimeAcquisFilePath, err)\n\t\t}\n\n\t\tlog.Debugf(\"copying %s to %s\", t.TemplateAppsecProfilePath, filepath.Join(t.RuntimePath, \"appsec-configs\", \"config.yaml\"))\n\t\t// copy template appsec-config file to runtime folder\n\t\tif err = Copy(t.TemplateAppsecProfilePath, filepath.Join(t.RuntimePath, \"appsec-configs\", \"config.yaml\")); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to copy '%s' to '%s': %w\", t.TemplateAppsecProfilePath, filepath.Join(t.RuntimePath, \"appsec-configs\", \"config.yaml\"), err)\n\t\t}\n\t} else { // otherwise we drop a blank acquis file\n\t\tif err = os.WriteFile(t.RuntimeAcquisFilePath, []byte(\"\"), os.ModePerm); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to write blank acquis file '%s': %w\", t.RuntimeAcquisFilePath, err)\n\t\t}\n\t}\n\n\t// install the hub in the runtime folder\n\tif err = t.InstallHub(ctx); err != nil {\n\t\treturn fmt.Errorf(\"unable to install hub in '%s': %w\", t.RuntimeHubPath, err)\n\t}\n\n\tif t.Config.LogFile != \"\" {\n\t\treturn t.RunWithLogFile(ctx)\n\t}\n\n\tif t.Config.NucleiTemplate != \"\" {\n\t\treturn t.RunWithNucleiTemplate(ctx)\n\t}\n\n\treturn fmt.Errorf(\"log file or nuclei template must be set in '%s'\", t.Name)\n}\n","sourceCodeStart":646,"sourceCodeEnd":677,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/hubtest_item.go#L646-L677","documentation":"This error is returned by HubTestItem.Run when t.InstallHub fails to install the hub (index, collections, parsers, etc.) into the test's runtime hub directory. It means the test environment is assembled but hub content could not be installed, so the test cannot execute; the underlying hub error (often network or index issues) is wrapped.","triggerScenarios":"Calling Run when the hub index (.index.json) is invalid or missing taints, downloading hub content fails (network offline / CAPI unreachable), or writing to t.RuntimeHubPath fails.","commonSituations":"Running hub tests behind a proxy or with no internet access; stale or corrupted .index.json copied into the runtime; hub taint/versions mismatch; disk full in the runtime hub path.","solutions":["Read the wrapped InstallHub error: if it is a network failure, fix connectivity or proxy settings and retry.","Refresh the hub index with `cscli hub update` before running tests.","Delete the runtime hub directory and re-run so installation starts from a clean state.","Verify the copied .index.json (t.HubIndexFile) is valid JSON and corresponds to the installed hub version."],"exampleFix":"// before\nitem.Run(ctx, patternDir) // \"unable to install hub in ...\": download failed\n// after: preflight hub index and connectivity\nif err := hub.Update(); err != nil {\n    return fmt.Errorf(\"run 'cscli hub update' first: %w\", err)\n}\nerr := item.Run(ctx, patternDir)","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(item.HubIndexFile); err != nil {\n    return fmt.Errorf(\"hub index missing, run 'cscli hub update': %w\", err)\n}\nif _, err := os.Stat(item.RuntimeHubPath); err != nil {\n    os.MkdirAll(item.RuntimeHubPath, 0o755)\n}","typeGuard":null,"tryCatchPattern":"if err := item.Run(ctx, patternDir); err != nil {\n    if strings.Contains(err.Error(), \"unable to install hub\") {\n        os.RemoveAll(item.RuntimeHubPath)\n        if herr := hub.Update(); herr != nil {\n            return fmt.Errorf(\"hub unreachable, check network/proxy: %w\", herr)\n        }\n        return item.Run(ctx, patternDir)\n    }\n    return err\n}","preventionTips":["Refresh the hub index (`cscli hub update`) before test runs.","Ensure outbound network or configure proxy/CAPI access in CI.","Clean the runtime hub directory after failed installs.","Validate .index.json integrity when copying it into the runtime."],"tags":["go","hub","hubtest","install"],"backgroundTag":"http-request-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"}