{"record":{"id":"603018b3d88a7978","repo":"anomalyco/sst","slug":"file-s-not-found","errorCode":null,"errorMessage":"File '%s' not found","messagePattern":"File '(.+?)' not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/fs/fs.go","lineNumber":23,"sourceCode":"\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\nfunc FindUp(initialPath, fileName string) (string, error) {\n\tcurrentDir := initialPath\n\tfor {\n\t\t// Check if the current directory contains the target file\n\t\tfilePath := filepath.Join(currentDir, fileName)\n\t\t_, err := os.Stat(filePath)\n\t\tif err == nil {\n\t\t\t// File found\n\t\t\treturn filePath, nil\n\t\t}\n\n\t\t// If we've reached the root directory, stop searching\n\t\tif currentDir == filepath.Dir(currentDir) {\n\t\t\treturn \"\", fmt.Errorf(\"File '%s' not found\", fileName)\n\t\t}\n\n\t\t// Move up to the parent directory\n\t\tcurrentDir = filepath.Dir(currentDir)\n\t}\n}\n\nfunc Exists(path string) bool {\n\t_, err := os.Stat(path)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn err == nil\n}\n\nfunc IsGitSubmodule(dir string) bool {\n\tgitPath := filepath.Join(dir, \".git\")\n\tinfo, err := os.Stat(gitPath)","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/internal/fs/fs.go#L5-L41","documentation":"FindUp walks parent directories from a start dir looking for fileName; when it reaches the filesystem root without a match it returns an error 'File <name> not found'. The library uses it to locate config files (e.g. sst.config.ts / package.json) relative to the working directory.","triggerScenarios":"Running the CLI from a directory that is not inside a project containing the target file (e.g. `sst dev` in ~ or /tmp, no sst.config.ts anywhere up the tree).","commonSituations":"Executing the binary outside the repo root; the config file was renamed or deleted; running inside a Docker image that copied only the source, not the config; using a subdirectory after moving the project root.","solutions":["cd into your project directory that contains the target file and rerun","Create the missing config file (e.g. sst.config.ts) at the project root","If using a custom file name, ensure it matches what FindUp searches for"],"exampleFix":"// before\n$ cd /tmp && sst dev\n// after\n$ cd ~/my-app && sst dev   # directory containing sst.config.ts","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(\"sst.config.ts\"); err != nil {\n    return fmt.Errorf(\"run this command from your project root\")\n}","typeGuard":"func configFileExists(root string, name string) bool {\n    p := filepath.Join(root, name)\n    _, err := os.Stat(p)\n    return err == nil\n}","tryCatchPattern":"path, err := fs.FindUp(\"sst.config.ts\")\nif err != nil {\n    return fmt.Errorf(\"no sst.config.ts found in %s or any parent dir\", cwd)\n}","preventionTips":["Run SST commands from the directory containing sst.config.ts","Check for the config file in CI before invoking the CLI","Avoid renaming the config file without updating any hardcoded lookups"],"tags":["filesystem","config","cli"],"backgroundTag":"config-file-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}