{"record":{"id":"ed2b780bfa91c19e","repo":"MHSanaei/3x-ui","slug":"failed-to-create-test-config-path-w","errorCode":null,"errorMessage":"Failed to create test config path: %w","messagePattern":"Failed to create test config path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/web/service/outbound/probe_http.go","lineNumber":288,"sourceCode":"\n// runHTTPProbeBatch makes one shared-process attempt for the given items,\n// writing per-request outcomes into the items' results. It returns a non-nil\n// error only when the process never became usable; retryPerItem reports\n// whether splitting the batch into per-item instances could help (true for\n// start failures / early exits that a poisoned config would explain, false\n// for environmental failures like a missing binary or no free ports).\nfunc runHTTPProbeBatch(items []*httpBatchItem, allOutbounds []any, testURL string, realDelay bool) (retryPerItem bool, err error) {\n\tports, release, err := reserveLoopbackPorts(len(items))\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"Failed to reserve test ports: %w\", err)\n\t}\n\tdefer release()\n\n\tcfg := buildBatchTestConfig(items, allOutbounds, ports)\n\n\tconfigPath, err := createTestConfigPath()\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"Failed to create test config path: %w\", err)\n\t}\n\tdefer os.Remove(configPath)\n\n\tproc := newBatchProcess(cfg, configPath)\n\tdefer func() {\n\t\tif proc.IsRunning() {\n\t\t\t_ = proc.Stop()\n\t\t}\n\t}()\n\n\t// Free the reserved ports just before xray binds them; the window is\n\t// milliseconds, and a lost race makes xray exit fast, which surfaces\n\t// below and triggers the per-item retry with fresh ports.\n\trelease()\n\tif err := proc.Start(); err != nil {\n\t\tif errors.Is(err, fs.ErrNotExist) {\n\t\t\t// Binary missing — per-item retries would all fail the same way.\n\t\t\treturn false, fmt.Errorf(\"Failed to start test xray instance: %w\", err)","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/MHSanaei/3x-ui/blob/ad32144c42455696ea9f14e12168beac3e25f5d2/internal/web/service/outbound/probe_http.go#L270-L306","documentation":"createTestConfigPath calls os.CreateTemp(config.GetBinFolderPath(), \"xray_test_*.json\") to reserve a temp config next to the xray binary. Failure means the bin folder does not exist or is not writable (CreateTemp's documented error conditions: pattern path nonexistent, permission denied, or disk full). Environmental — retrying per-item would not help.","triggerScenarios":"Running an outbound test when the bin folder (XUI_BIN_FOLDER override or default) is missing, read-only, owned by another user, or the disk/tmpfs is full.","commonSituations":"XUI_BIN_FOLDER points at a path that does not exist; panel binary run as a user without write access to /usr/local/x-ui/bin; a read-only rootfs container; full disk on a small VPS.","solutions":["Ensure the bin folder exists and is writable by the panel user: mkdir -p <bin folder> && chown","Check disk space (df -h) and inode usage if the folder is fine","Fix an incorrect XUI_BIN_FOLDER env var"],"exampleFix":"# before\nXUI_BIN_FOLDER=/opt/xray-bin ./x-ui   # folder absent -> CreateTemp fails\n\n# after\nmkdir -p /opt/xray-bin && chown xui /opt/xray-bin\nXUI_BIN_FOLDER=/opt/xray-bin ./x-ui","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(config.GetBinFolderPath()); err != nil || !info.IsDir() {\n    return errors.New(\"bin folder missing; cannot run outbound test\")\n}\n// optionally probe writability\nif f, err := os.CreateTemp(config.GetBinFolderPath(), \"pre_*.json\"); err != nil {\n    return errors.New(\"bin folder not writable\")\n} else { f.Close(); os.Remove(f.Name()) }","typeGuard":null,"tryCatchPattern":"_, err := runHTTPProbeBatch(items, all, url, true)\nif err != nil && strings.Contains(err.Error(), \"create test config path\") {\n    // fix folder perms/disk; do not retry until fixed\n}","preventionTips":["Health-check the bin folder's existence and writability at panel startup","Monitor disk space on the bin-folder volume"],"tags":["filesystem","permissions","disk-full","outbounds","environment"],"backgroundTag":null,"analyzedSha":"ad32144c42455696ea9f14e12168beac3e25f5d2","analyzedAt":"2026-08-15T11:13:23.905Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}