{"record":{"id":"9806623164c39aba","repo":"jdx/mise","slug":"rel-is-not-a-directory-of-the-repository","errorCode":null,"errorMessage":"{rel} is not a directory of the repository","messagePattern":"(.+?) is not a directory of the repository","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packslip.rs","lineNumber":679,"sourceCode":"    commit: &str,\n    rel: &str,\n    dest: &Path,\n    pr: &dyn SingleReport,\n) -> Result<()> {\n    let url = format!(\n        \"https://api.github.com/repos/{repo}/contents/{}?ref={commit}\",\n        url_path(rel)\n    );\n    // The client asks for the raw media type on every contents URL, which\n    // is right for a file body and wrong for a directory listing.\n    let mut headers = github::get_headers(&url)?;\n    headers.insert(\n        reqwest::header::ACCEPT,\n        HeaderValue::from_static(\"application/vnd.github+json\"),\n    );\n    let listing: serde_json::Value = HTTP_FETCH.json_with_headers(&url, &headers).await?;\n    let Some(entries) = listing.as_array() else {\n        bail!(\"{rel} is not a directory of the repository\");\n    };\n    file::create_dir_all(dest)?;\n    for entry in entries {\n        let Some(name) = entry[\"name\"].as_str() else {\n            continue;\n        };\n        if !file::is_plain_file_name(name) {\n            continue;\n        }\n        match entry[\"type\"].as_str() {\n            Some(\"dir\") => {\n                Box::pin(fetch_repo_dir(\n                    repo,\n                    commit,\n                    &format!(\"{rel}/{name}\"),\n                    &dest.join(name),\n                    pr,\n                ))","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/packslip.rs#L661-L697","documentation":"fetch_repo_dir lists a subdirectory of a GitHub repository via the contents API expecting a JSON array of entries. If the response is valid JSON but not an array (typically an object with a 'message' field, e.g. 404 'Not Found'), it bails saying the path is not a directory of the repository.","triggerScenarios":"The rel path does not exist in the repo, points at a file instead of a directory, the repo/branch is wrong or private without credentials, or the API returned an error object (rate limit, 404).","commonSituations":"Typo in the packslip's directory path, path exists only on a different branch/tag, repository renamed or made private, GitHub API rate limiting returned an error object.","solutions":["Verify the path exists as a directory in the specified repo and branch","Check for typos in the rel path and repository URL","Ensure credentials are available if the repo is private","Check GitHub API rate-limit status if the message persists despite a valid path"],"exampleFix":"// before (packslip)\n// repo_dir = \"skills/completion\"   # path does not exist on main\n// after\n// repo_dir = \"skills/completions\"  # actual directory on main","handlingStrategy":"validation","validationCode":"// confirm the path is a directory via the API first\nconst res = await gh(`repos/${repo}/contents/${path}?ref=${branch}`);\nif (!Array.isArray(res)) throw new Error(`${path} is not a directory on ${branch}`);","typeGuard":null,"tryCatchPattern":"try { await fetchRepoDir(...) } catch (e) { if (/is not a directory of the repository/.test(e.message)) { fixPathOrBranch(); } else { throw e; } }","preventionTips":["Verify the directory exists on the target branch/tag","Check repo visibility and supply credentials for private repos","Watch GitHub API rate limits","Avoid typos in rel paths; test with the contents API"],"tags":["github","api","packslip","path"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}