{"record":{"id":"10604c9e8a335e58","repo":"owasp-amass/amass","slug":"mkdir-failed-for-s-v","errorCode":null,"errorMessage":"mkdir failed for %s: %v","messagePattern":"mkdir failed for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/file.go","lineNumber":26,"sourceCode":"\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/owasp-amass/amass/v5/config\"\n\t\"github.com/owasp-amass/amass/v5/resources\"\n)\n\nfunc CreateOutputDirectory(dirpath string) error {\n\t// Prepare output file paths\n\tdir := config.OutputDirectory(dirpath)\n\tif dir == \"\" {\n\t\treturn errors.New(\"failed to obtain the path for the output directory\")\n\t}\n\t// If the directory does not yet exist, create it\n\tif err := os.MkdirAll(dir, 0755); err != nil {\n\t\treturn fmt.Errorf(\"mkdir failed for %s: %v\", dir, err)\n\t}\n\t// ensure that the permissions are set correctly\n\tif err := os.Chmod(dir, 0755); err != nil {\n\t\treturn fmt.Errorf(\"failed to set permissions to 0755 for %s: %v\", dir, err)\n\t}\n\treturn nil\n}\n\nfunc CreateDefaultConfigFiles(dirpath string) error {\n\tfor _, filename := range resources.DefaultFilesList {\n\t\tfilepath := filepath.Join(dirpath, filename)\n\t\tif _, err := os.Stat(filepath); !os.IsNotExist(err) {\n\t\t\t// If the file already exists, skip creating it\n\t\t\tcontinue\n\t\t}\n\n\t\tfile, err := resources.GetResourceFile(filename)\n\t\tif err != nil {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/internal/tools/file.go#L8-L44","documentation":"CreateOutputDirectory resolves the output directory path via config.OutputDirectory and creates it (and any missing parents) with os.MkdirAll. This error wraps any failure from MkdirAll, meaning the directory could not be created at the requested path.","triggerScenarios":"Calling CreateOutputDirectory when a path component of dir is not a directory, the filesystem is read-only, the process lacks write permission on a parent, the disk is full, or dir is invalid (e.g. empty path components, too-long path).","commonSituations":"Running the CLI in a container with a read-only rootfs, pointing the output directory at /usr or another protected location without sudo, OUTPUT_DIR pointing into a file rather than a directory, or NFS/EFS mounts with permission restrictions.","solutions":["Check that every component of the resolved path exists and is a directory; remove or rename any file that occupies the path","Run with sufficient privileges or choose a writable output directory (e.g. $HOME/amass-output)","Check free disk space (df -h) and filesystem mount status (mount | grep ro)","Print the resolved dir and verify it manually with mkdir -p before retrying"],"exampleFix":"// before\nif err := os.MkdirAll(\"/usr/local/amass/output\", 0755); err != nil { ... }\n// after\noutDir := filepath.Join(os.Getenv(\"HOME\"), \"amass-output\")\nif err := os.MkdirAll(outDir, 0755); err != nil { ... }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["go","filesystem","mkdir","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}