{"record":{"id":"787532a953687f59","repo":"Tencent/WeKnora","slug":"sandbox-stat-s-w","errorCode":null,"errorMessage":"sandbox: stat %s: %w","messagePattern":"sandbox: stat (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_manager.go","lineNumber":926,"sourceCode":"\t}\n\tif handle == nil || handle.ID() != binding.SandboxID ||\n\t\thandle.Provider() != m.client.Provider() {\n\t\treturn nil, false, errors.New(\"sandbox: remote handle does not match binding\")\n\t}\n\treturn handle, true, nil\n}\n\nfunc (m *SessionBoundManager) listFilesRecursive(\n\tctx context.Context,\n\thandle RemoteSandboxHandle,\n\tdir string,\n) ([]RemoteDirEntry, error) {\n\tstat, err := m.client.Stat(ctx, handle, dir)\n\tif err != nil {\n\t\tif IsRemoteNotFound(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"sandbox: stat %s: %w\", dir, err)\n\t}\n\tif stat == nil {\n\t\treturn nil, nil\n\t}\n\n\tstack := []string{dir}\n\tvar files []RemoteDirEntry\n\tfor len(stack) > 0 {\n\t\tcur := stack[len(stack)-1]\n\t\tstack = stack[:len(stack)-1]\n\n\t\tentries, err := m.client.ListDir(ctx, handle, cur)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, entry := range entries {\n\t\t\tif entry.Path == \"\" {\n\t\t\t\tentry.Path = path.Join(cur, entry.Name)","sourceCodeStart":908,"sourceCodeEnd":944,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_manager.go#L908-L944","documentation":"Wrapping error in listFilesRecursive when m.client.Stat on a directory fails with an error other than remote-not-found (not-found is treated as an empty listing). Listing of session files therefore fails with the provider's stat error wrapped, e.g. permission or connectivity problems on that directory.","triggerScenarios":"Thrown at internal/sandbox/session_manager.go:926 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped provider error for the failing directory","Retry listing on transient errors","If the directory genuinely vanished mid-walk, treat as not-found and skip"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}