{"record":{"id":"40188d3f6196f5b5","repo":"google-gemini/gemini-cli","slug":"unable-to-create-dirpath-directory-do-you-have","errorCode":null,"errorMessage":"Unable to create ${dirPath} directory. Do you have file permissions in the current directory?","messagePattern":"Unable to create (.+?) directory\\. Do you have file permissions in the current directory\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/ui/commands/setupGithubCommand.ts","lineNumber":176,"sourceCode":"          flush: true,\n        });\n\n        await body.pipeTo(Writable.toWeb(fileStream));\n      })(),\n    );\n  }\n\n  await Promise.all(downloads).finally(() => {\n    abortController.abort();\n  });\n}\n\nasync function createDirectory(dirPath: string): Promise<void> {\n  try {\n    await fs.promises.mkdir(dirPath, { recursive: true });\n  } catch (error) {\n    debugLogger.debug(`Failed to create ${dirPath} directory:`, error);\n    throw new Error(\n      `Unable to create ${dirPath} directory. Do you have file permissions in the current directory?`,\n    );\n  }\n}\n\nasync function downloadSetupFiles({\n  configs,\n  releaseTag,\n  proxy,\n}: {\n  configs: Array<{ paths: string[]; targetDir: string }>;\n  releaseTag: string;\n  proxy: string | undefined;\n}): Promise<void> {\n  try {\n    await Promise.all(\n      configs.map(({ paths, targetDir }) => {\n        const abortController = new AbortController();","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/ui/commands/setupGithubCommand.ts#L158-L194","documentation":"Thrown by createDirectory() when fs.promises.mkdir(dirPath, { recursive: true }) rejects — typically the .github/workflows directory (or another target) could not be created. The underlying error is logged via debugLogger before this generic message is thrown.","triggerScenarios":"mkdir with recursive:true throws inside createDirectory(); the catch wraps any filesystem error (EACCES, EROFS, ENOSPC, ENAMETOOLONG) and rethrows this message.","commonSituations":"The git repo root is on a read-only filesystem or the user lacks write permission; the target path is invalid/locked; the disk is full; running /setup-github in a directory the process cannot write to.","solutions":["Check write permissions on the repo root and parent of .github/workflows (`ls -la` and try `touch` a test file).","Run the CLI with appropriate filesystem permissions / as a user that can write to the repo.","If the disk is full, free space (df -h) and retry.","Confirm the repo root path returned by git is writable and not on a read-only mount."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nasync function isWritableDir(dirPath: string): Promise<boolean> {\n  try {\n    await fs.promises.access(path.dirname(dirPath), fs.constants.W_OK);\n    return true;\n  } catch { return false; }\n}","typeGuard":"function isMkdirError(e: unknown): boolean {\n  return e instanceof Error && /Unable to create .* directory/.test(e.message);\n}","tryCatchPattern":"try {\n  await runSetupGithub(ctx);\n} catch (e) {\n  if (e instanceof Error && /Unable to create .* directory/.test(e.message)) {\n    // check write permissions / disk space on the repo root and retry\n  }\n  throw e;\n}","preventionTips":["Confirm write permission on the repo root before running /setup-github.","Ensure the working volume is not read-only or full (df -h).","Run the CLI as a user permitted to write to the repository."],"tags":["filesystem","permissions","setup-github","mkdir","io"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}