{"record":{"id":"2fc534ac69220e5d","repo":"router-for-me/CLIProxyAPI","slug":"resolve-plugins-directory-w","errorCode":null,"errorMessage":"resolve plugins directory: %w","messagePattern":"resolve plugins directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/plugin_path.go","lineNumber":22,"sourceCode":"\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\nconst defaultPluginsDir = \"plugins\"\n\n// ResolvePluginsDir normalizes the plugin directory for consistent use throughout the app.\n// It expands a leading tilde (~) to the user's home directory and defaults empty values to plugins.\nfunc ResolvePluginsDir(pluginsDir string) (string, error) {\n\tpluginsDir = strings.TrimSpace(pluginsDir)\n\tif pluginsDir == \"\" {\n\t\tpluginsDir = defaultPluginsDir\n\t}\n\tif strings.HasPrefix(pluginsDir, \"~\") {\n\t\thomeDir, errUserHomeDir := os.UserHomeDir()\n\t\tif errUserHomeDir != nil {\n\t\t\treturn \"\", fmt.Errorf(\"resolve plugins directory: %w\", errUserHomeDir)\n\t\t}\n\t\tremainder := strings.TrimPrefix(pluginsDir, \"~\")\n\t\tremainder = strings.TrimLeft(remainder, \"/\\\\\")\n\t\tif remainder == \"\" {\n\t\t\treturn filepath.Clean(homeDir), nil\n\t\t}\n\t\tnormalized := strings.ReplaceAll(remainder, \"\\\\\", \"/\")\n\t\treturn filepath.Clean(filepath.Join(homeDir, filepath.FromSlash(normalized))), nil\n\t}\n\treturn filepath.Clean(pluginsDir), nil\n}\n\n// ResolvePluginsDir resolves and stores the effective plugin directory.\nfunc (cfg *Config) ResolvePluginsDir() error {\n\tif cfg == nil {\n\t\treturn nil\n\t}\n\tpluginsDir, errResolvePluginsDir := ResolvePluginsDir(cfg.Plugins.Dir)","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/config/plugin_path.go#L4-L40","documentation":"Error \"resolve plugins directory: %w\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/config/plugin_path.go:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the plugins directory path exists or can be created.","Check the wrapped error for path resolution or permission failures."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}