wavetermdev/waveterm · error
failed to resolve %s to absolute path: %w
Error message
failed to resolve %s to absolute path: %w
What it means
After reading EnvTsunamiScaffoldPath, validateEnvironmentVars calls filepath.Abs to convert it into an absolute path. If filepath.Abs fails (e.g. current working directory cannot be resolved because it was deleted), the build aborts with this wrapped error.
Source
Thrown at tsunami/cmd/main-tsunami.go:46
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print Tsunami version",
Long: `Print Tsunami version`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("v" + tsunamibase.TsunamiVersion)
},
}
func validateEnvironmentVars(opts *build.BuildOpts) error {
scaffoldPath := os.Getenv(EnvTsunamiScaffoldPath)
if scaffoldPath == "" {
return fmt.Errorf("%s environment variable must be set", EnvTsunamiScaffoldPath)
}
absScaffoldPath, err := filepath.Abs(scaffoldPath)
if err != nil {
return fmt.Errorf("failed to resolve %s to absolute path: %w", EnvTsunamiScaffoldPath, err)
}
sdkReplacePath := os.Getenv(EnvTsunamiSdkReplacePath)
if sdkReplacePath == "" {
return fmt.Errorf("%s environment variable must be set", EnvTsunamiSdkReplacePath)
}
absSdkReplacePath, err := filepath.Abs(sdkReplacePath)
if err != nil {
return fmt.Errorf("failed to resolve %s to absolute path: %w", EnvTsunamiSdkReplacePath, err)
}
opts.ScaffoldPath = absScaffoldPath
opts.SdkReplacePath = absSdkReplacePath
// NodePath is optional
if nodePath := os.Getenv(EnvTsunamiNodePath); nodePath != "" {
opts.NodePath = nodePath
}View on GitHub (pinned to a4447c1563)
Solutions
- cd to a valid existing directory before running the command
- Ensure TSUNAMI_SCAFFOLD_PATH points to a real path and the cwd exists
- Recreate the working directory or restart the shell in a valid location
Example fix
// before $ cd /tmp/old-dir && tsunami build # dir deleted // after $ cd /path/to/project && tsunami build
Defensive patterns
Strategy: validation
Validate before calling
scaffold := os.Getenv("TSUNAMI_SCAFFOLD_PATH")
if scaffold == "" {
return errors.New("TSUNAMI_SCAFFOLD_PATH must be set")
}
if _, err := filepath.Abs(scaffold); err != nil {
return fmt.Errorf("cannot resolve scaffold path (check cwd exists): %w", err)
} Try / catch
if err := validateEnvironmentVars(opts); err != nil {
if strings.Contains(err.Error(), "absolute path") {
log.Fatal("working directory invalid; cd to a real directory and retry")
}
} Prevention
- Always run the CLI from an existing directory
- Verify cwd with pwd before running in scripts
- Check that the configured scaffold path exists on disk
When it happens
Trigger: TSUNAMI_SCAFFOLD_PATH is set but filepath.Abs returns an error — typically because os.Getwd fails since the process's working directory no longer exists.
Common situations: Running the tool from a directory that was deleted/recreated while the shell sat in it; a container or CI workspace removed before the step runs.
Related errors
- %s environment variable must be set
- setting auth key: %v
- no WAVETERM_TABID env var set
- no WAVETERM_TABID env var set
- no WAVETERM_TABID env var set
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/e479fcc0756b9252.
Report an issue: GitHub.