jdx/mise · error
is not a directory of the repository
Error message
{rel} is not a directory of the repository What it means
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.
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
Example fix
// before (packslip) // repo_dir = "skills/completion" # path does not exist on main // after // repo_dir = "skills/completions" # actual directory on main
Defensive patterns
Strategy: validation
Validate before calling
// confirm the path is a directory via the API first
const res = await gh(`repos/${repo}/contents/${path}?ref=${branch}`);
if (!Array.isArray(res)) throw new Error(`${path} is not a directory on ${branch}`); Try / catch
try { await fetchRepoDir(...) } catch (e) { if (/is not a directory of the repository/.test(e.message)) { fixPathOrBranch(); } else { throw e; } } Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- tap directory tree was truncated
- tap repository tree was truncated
- a provided source resolves to a path
- a validated copy_link has a staged parent
- an exec entry with no command
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/9806623164c39aba.
Report an issue: GitHub.
Appendix: source
Thrown at src/packslip.rs:679
commit: &str,
rel: &str,
dest: &Path,
pr: &dyn SingleReport,
) -> Result<()> {
let url = format!(
"https://api.github.com/repos/{repo}/contents/{}?ref={commit}",
url_path(rel)
);
// The client asks for the raw media type on every contents URL, which
// is right for a file body and wrong for a directory listing.
let mut headers = github::get_headers(&url)?;
headers.insert(
reqwest::header::ACCEPT,
HeaderValue::from_static("application/vnd.github+json"),
);
let listing: serde_json::Value = HTTP_FETCH.json_with_headers(&url, &headers).await?;
let Some(entries) = listing.as_array() else {
bail!("{rel} is not a directory of the repository");
};
file::create_dir_all(dest)?;
for entry in entries {
let Some(name) = entry["name"].as_str() else {
continue;
};
if !file::is_plain_file_name(name) {
continue;
}
match entry["type"].as_str() {
Some("dir") => {
Box::pin(fetch_repo_dir(
repo,
commit,
&format!("{rel}/{name}"),
&dest.join(name),
pr,
))View on GitHub (pinned to 533346cc37)