anomalyco/sst · error

File '%s' not found

Error message

File '%s' not found

What it means

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.

Source

Thrown at internal/fs/fs.go:23

	"os"
	"path/filepath"
	"strings"
)

func FindUp(initialPath, fileName string) (string, error) {
	currentDir := initialPath
	for {
		// Check if the current directory contains the target file
		filePath := filepath.Join(currentDir, fileName)
		_, err := os.Stat(filePath)
		if err == nil {
			// File found
			return filePath, nil
		}

		// If we've reached the root directory, stop searching
		if currentDir == filepath.Dir(currentDir) {
			return "", fmt.Errorf("File '%s' not found", fileName)
		}

		// Move up to the parent directory
		currentDir = filepath.Dir(currentDir)
	}
}

func Exists(path string) bool {
	_, err := os.Stat(path)
	if os.IsNotExist(err) {
		return false
	}
	return err == nil
}

func IsGitSubmodule(dir string) bool {
	gitPath := filepath.Join(dir, ".git")
	info, err := os.Stat(gitPath)

View on GitHub (pinned to a0bd20f762)

Solutions

  1. cd into your project directory that contains the target file and rerun
  2. Create the missing config file (e.g. sst.config.ts) at the project root
  3. If using a custom file name, ensure it matches what FindUp searches for

Example fix

// before
$ cd /tmp && sst dev
// after
$ cd ~/my-app && sst dev   # directory containing sst.config.ts
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat("sst.config.ts"); err != nil {
    return fmt.Errorf("run this command from your project root")
}

Type guard

func configFileExists(root string, name string) bool {
    p := filepath.Join(root, name)
    _, err := os.Stat(p)
    return err == nil
}

Try / catch

path, err := fs.FindUp("sst.config.ts")
if err != nil {
    return fmt.Errorf("no sst.config.ts found in %s or any parent dir", cwd)
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/603018b3d88a7978. Report an issue: GitHub.