{"record":{"id":"315108e9ed1c1a91","repo":"micro-editor/micro","slug":"plugin-s-does-not-exist","errorCode":null,"errorMessage":"Plugin %s does not exist","messagePattern":"Plugin (.+?) does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/rtfiles.go","lineNumber":296,"sourceCode":"\t}\n\treturn \"\"\n}\n\n// PluginListRuntimeFiles allows plugins to lists all runtime files of the given type\nfunc PluginListRuntimeFiles(fileType RTFiletype) []string {\n\tfiles := ListRuntimeFiles(fileType)\n\tresult := make([]string, len(files))\n\tfor i, f := range files {\n\t\tresult[i] = f.Name()\n\t}\n\treturn result\n}\n\n// PluginAddRuntimeFile adds a file to the runtime files for a plugin\nfunc PluginAddRuntimeFile(plugin string, filetype RTFiletype, filePath string) error {\n\tpl := FindPlugin(plugin)\n\tif pl == nil {\n\t\treturn errors.New(\"Plugin \" + plugin + \" does not exist\")\n\t}\n\tpldir := pl.DirName\n\tfullpath := filepath.Join(ConfigDir, \"plug\", pldir, filePath)\n\tif _, err := os.Stat(fullpath); err == nil {\n\t\tAddRealRuntimeFile(filetype, realFile(fullpath))\n\t} else {\n\t\tfullpath = filepath.Join(\"runtime\", \"plugins\", pldir, filePath)\n\t\tAddRuntimeFile(filetype, assetFile(fullpath))\n\t}\n\treturn nil\n}\n\n// PluginAddRuntimeFilesFromDirectory adds files from a directory to the runtime files for a plugin\nfunc PluginAddRuntimeFilesFromDirectory(plugin string, filetype RTFiletype, directory, pattern string) error {\n\tpl := FindPlugin(plugin)\n\tif pl == nil {\n\t\treturn errors.New(\"Plugin \" + plugin + \" does not exist\")\n\t}","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/micro-editor/micro/blob/1c8b82b32e408a5faf340039ed92d5266bea3293/internal/config/rtfiles.go#L278-L314","documentation":"Returned by config.PluginAddRuntimeFile — the Go backend of the Lua AddRuntimeFile API — when FindPlugin(plugin) returns nil, i.e. no loaded plugin has the given name. The plugin was trying to register a runtime file (colorscheme, syntax, ftplugin, etc.) under a plugin identity micro does not know.","triggerScenarios":"A plugin's init.lua calling AddRuntimeFile('myplugin', RTCOLORSCHEME, 'colors.my.micro') where the installed folder name differs (case-sensitive!) from 'myplugin', or the call happening for a plugin that failed/is not loaded. FindPlugin matches the plugin's registered name at internal/config/rtfiles.go:296.","commonSituations":"Renaming a plugin's directory without updating init.lua strings, copy-pasting AddRuntimeFile boilerplate between plugins, or plugin renamed upstream while the user kept an old fork with hardcoded names.","solutions":["Make the name string exactly equal to the plugin's folder name under ~/.config/micro/plug/ (case-sensitive).","Prefer not hardcoding: in the plugin repo the canonical pattern is AddRuntimeFile(plugin_name, ...) where plugin_name comes from the repo layout — keep them in sync.","Verify the plugin actually loaded: check `micro -version`/plugin listing or look for load errors on startup.","If the plugin is optional, wrap the Lua call in pcall to degrade gracefully."],"exampleFix":"-- before (~/.config/micro/plug/MyPlug/init.lua):\nAddRuntimeFile('myplug', RTSYNTAX, 'syntax.yaml')\n\n-- after (folder is MyPlug):\nAddRuntimeFile('MyPlug', RTSYNTAX, 'syntax.yaml')","handlingStrategy":"validation","validationCode":"-- inside init.lua, before registering files:\nlocal ok = pcall(function() return GetPlugin(pluginName) end)\n-- or simply align the string with the folder name and wrap:\nlocal ok, err = pcall(AddRuntimeFile, \"MyPlug\", RTSYNTAX, \"syntax.yaml\")\nif not ok then print(\"AddRuntimeFile failed: \" .. tostring(err)) end","typeGuard":null,"tryCatchPattern":"-- Lua caller wraps the API in pcall:\nlocal ok, err = pcall(AddRuntimeFile, pluginName, RTCOLORSCHEME, \"scheme.micro\")\nif not ok then\n  -- err contains 'Plugin <name> does not exist': fix name or skip registration\nend","preventionTips":["Keep the plugin's folder name and every name string in its init.lua byte-identical (case matters).","Never copy AddRuntimeFile lines between plugins without updating the name argument.","Check the plugin actually loaded (no startup plugin errors) before expecting registration calls to succeed."],"tags":["plugins","lua-api","runtime-files","names"],"backgroundTag":null,"analyzedSha":"1c8b82b32e408a5faf340039ed92d5266bea3293","analyzedAt":"2026-08-15T20:01:45.134Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}