{"record":{"id":"e479fcc0756b9252","repo":"wavetermdev/waveterm","slug":"failed-to-resolve-s-to-absolute-path-w","errorCode":null,"errorMessage":"failed to resolve %s to absolute path: %w","messagePattern":"failed to resolve (.+?) to absolute path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tsunami/cmd/main-tsunami.go","lineNumber":46,"sourceCode":"}\n\nvar versionCmd = &cobra.Command{\n\tUse:   \"version\",\n\tShort: \"Print Tsunami version\",\n\tLong:  `Print Tsunami version`,\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tfmt.Println(\"v\" + tsunamibase.TsunamiVersion)\n\t},\n}\n\nfunc validateEnvironmentVars(opts *build.BuildOpts) error {\n\tscaffoldPath := os.Getenv(EnvTsunamiScaffoldPath)\n\tif scaffoldPath == \"\" {\n\t\treturn fmt.Errorf(\"%s environment variable must be set\", EnvTsunamiScaffoldPath)\n\t}\n\tabsScaffoldPath, err := filepath.Abs(scaffoldPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to resolve %s to absolute path: %w\", EnvTsunamiScaffoldPath, err)\n\t}\n\n\tsdkReplacePath := os.Getenv(EnvTsunamiSdkReplacePath)\n\tif sdkReplacePath == \"\" {\n\t\treturn fmt.Errorf(\"%s environment variable must be set\", EnvTsunamiSdkReplacePath)\n\t}\n\tabsSdkReplacePath, err := filepath.Abs(sdkReplacePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to resolve %s to absolute path: %w\", EnvTsunamiSdkReplacePath, err)\n\t}\n\n\topts.ScaffoldPath = absScaffoldPath\n\topts.SdkReplacePath = absSdkReplacePath\n\n\t// NodePath is optional\n\tif nodePath := os.Getenv(EnvTsunamiNodePath); nodePath != \"\" {\n\t\topts.NodePath = nodePath\n\t}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/tsunami/cmd/main-tsunami.go#L28-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n$ cd /tmp/old-dir && tsunami build  # dir deleted\n// after\n$ cd /path/to/project && tsunami build","handlingStrategy":"validation","validationCode":"scaffold := os.Getenv(\"TSUNAMI_SCAFFOLD_PATH\")\nif scaffold == \"\" {\n    return errors.New(\"TSUNAMI_SCAFFOLD_PATH must be set\")\n}\nif _, err := filepath.Abs(scaffold); err != nil {\n    return fmt.Errorf(\"cannot resolve scaffold path (check cwd exists): %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := validateEnvironmentVars(opts); err != nil {\n    if strings.Contains(err.Error(), \"absolute path\") {\n        log.Fatal(\"working directory invalid; cd to a real directory and retry\")\n    }\n}","preventionTips":["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"],"tags":["go","path","environment","cli"],"backgroundTag":"path-resolution-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}