{"record":{"id":"23bf4222bb8a7587","repo":"cakephp/cakephp","slug":"cannot-format-editor-url-s-is-not-a-known-editor","errorCode":null,"errorMessage":"Cannot format editor URL `%s` is not a known editor.","messagePattern":"Cannot format editor URL `(.+?)` is not a known editor\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Error/Debugger.php","lineNumber":237,"sourceCode":"                $known,\n            ));\n        }\n        $instance->setConfig('editor', $name);\n    }\n\n    /**\n     * Get a formatted URL for the active editor.\n     *\n     * @param string $file The file to create a link for.\n     * @param int $line The line number to create a link for.\n     * @return string The formatted URL.\n     */\n    public static function editorUrl(string $file, int $line): string\n    {\n        $instance = static::getInstance();\n        $editor = $instance->getConfig('editor');\n        if (!isset($instance->editors[$editor])) {\n            throw new InvalidArgumentException(sprintf(\n                'Cannot format editor URL `%s` is not a known editor.',\n                $editor,\n            ));\n        }\n\n        $editorBasePath = $instance->getConfig('editorBasePath');\n        if ($editorBasePath !== null && is_string($editorBasePath)) {\n            $file = str_replace(ROOT, $editorBasePath, $file);\n        }\n\n        $template = $instance->editors[$editor];\n        if (is_string($template)) {\n            return str_replace(['{file}', '{line}'], [$file, (string)$line], $template);\n        }\n\n        return $template($file, $line);\n    }\n","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/cakephp/cakephp/blob/1128eba9b09f1946df684811350e26f2cef68fac/src/Error/Debugger.php#L219-L255","documentation":"Debugger::editorUrl() reads the configured 'editor' config and requires it to exist in the registered editors map before it can build a clickable file URL. If the configured editor is unknown (or was never set/registered), it throws InvalidArgumentException.","triggerScenarios":"Calling Debugger::editorUrl($file, $line) after setConfig('editor', ...) was set to an unregistered name, or with the default editor config removed/invalid.","commonSituations":"Setting editor via config string without registering a custom editor; serialization/config drift where 'editor' holds a stale name; tests overriding editor config with invalid values.","solutions":["Call Debugger::setEditor() with a valid, registered editor name before editorUrl()","If a custom editor is intended, register it with addEditor() first","Inspect Debugger::getConfig('editor') and correct the value"],"exampleFix":"// before\nDebugger::setConfig('editor', 'mine');\n$url = Debugger::editorUrl('/app/src/Foo.php', 12);\n// after\nDebugger::setEditor('vscode');\n$url = Debugger::editorUrl('/app/src/Foo.php', 12);","handlingStrategy":"validation","validationCode":"$editor = Debugger::getConfig('editor'); if (!in_array($editor, array_keys(Debugger::getEditors()), true)) { Debugger::setEditor('phpstorm'); }","typeGuard":null,"tryCatchPattern":"try { $url = Debugger::editorUrl($file, $line); } catch (\\InvalidArgumentException $e) { $url = $file . ':' . $line; }","preventionTips":["Always set the editor via setEditor(), never raw setConfig('editor', ...) with unknown names","Centralize editor setup in app bootstrap","Log a warning when the configured editor is not registered"],"tags":["debugger","editor","invalid-config-value"],"backgroundTag":"invalid-config-value","analyzedSha":"1128eba9b09f1946df684811350e26f2cef68fac","analyzedAt":"2026-09-12T12:07:00.388Z","contentChangedAt":"2026-09-12T12:07:00.388Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}