{"record":{"id":"3141032a45c1df4b","repo":"asdf-vm/asdf","slug":"command-not-found","errorCode":null,"errorMessage":"command not found","messagePattern":"command not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cli/cli.go","lineNumber":1451,"sourceCode":"\t\tlogger.Printf(\"error loading config: %s\", err)\n\t\treturn err\n\t}\n\n\tcurrentDir, err := os.Getwd()\n\tif err != nil {\n\t\tlogger.Printf(\"unable to get current directory: %s\", err)\n\t\treturn err\n\t}\n\n\tif command == \"\" {\n\t\tfmt.Println(\"usage: asdf which <command>\")\n\t\treturn errors.New(\"must provide command\")\n\t}\n\n\tpath, _, _, _, err := shims.FindExecutable(conf, command, currentDir)\n\tif _, ok := err.(shims.UnknownCommandError); ok {\n\t\tlogger.Printf(\"unknown command: %s. Perhaps you have to reshim?\", command)\n\t\treturn errors.New(\"command not found\")\n\t}\n\n\tif _, ok := err.(shims.NoExecutableForPluginError); ok {\n\t\tlogger.Printf(\"%s\", err.Error())\n\t\treturn errors.New(\"no executable for tool version\")\n\t}\n\n\tif err != nil {\n\t\tfmt.Printf(\"unexpected error: %s\\n\", err.Error())\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"%s\\n\", path)\n\treturn nil\n}\n\nfunc uninstallCommand(logger *log.Logger, tool, version string) error {\n\tif tool == \"\" || version == \"\" {","sourceCodeStart":1433,"sourceCodeEnd":1469,"githubUrl":"https://github.com/asdf-vm/asdf/blob/074a1722ca88d6677f228541ce06efaf4f9924d4/internal/cli/cli.go#L1433-L1469","documentation":"`asdf which <command>` looks up the command via shims.FindExecutable. When that returns shims.UnknownCommandError, meaning no shim exists for the command in the current directory's tool versions, the CLI translates it to 'command not found'.","triggerScenarios":"Running `asdf which <cmd>` where the command is not provided by any installed plugin/version for the current directory, or shims are missing because `asdf reshim` was never run after installing a version.","commonSituations":"After installing a new tool version but not running `asdf reshim`; typos in the command name; tool not installed at all; working directory with no version pin and no global default.","solutions":["Run `asdf reshim <tool> <version>` to regenerate shims for installed versions","Verify the tool is installed: `asdf list <tool>`; install it if not (`asdf install <tool> <version>`)","Check `.tool-versions` in the current directory and parents for the expected tool name/typos"],"exampleFix":"// before\n$ asdf which terraform   # shim missing after install\n// after\n$ asdf reshim terraform 1.9.0 && asdf which terraform","handlingStrategy":"try-catch","validationCode":"if ! asdf list \"$TOOL\" >/dev/null 2>&1; then\n  echo \"tool not installed: $TOOL\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":"if path=$(asdf which \"$CMD\" 2>&1); then\n  echo \"$path\"\nelse\n  echo \"$path\"       # prints 'unknown command...' hint\n  asdf reshim         # common remedy before retry\nfi","preventionTips":["Run `asdf reshim` after every install/uninstall","Keep .tool-versions in sync with installed versions","Verify the exact command name exists in the plugin's bin directory"],"tags":["cli","shims","command-not-found"],"backgroundTag":"command-not-found","analyzedSha":"074a1722ca88d6677f228541ce06efaf4f9924d4","analyzedAt":"2026-08-30T19:56:42.972Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}