{"record":{"id":"6d391111af5a78f1","repo":"sxyazi/yazi","slug":"unknown-copy-type","errorCode":null,"errorMessage":"Unknown copy type: {}","messagePattern":"Unknown copy type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-actor/src/mgr/copy.rs","lineNumber":51,"sourceCode":"\t\t\t\t\ts.extend_from_slice(&form.separator.transform(&f.url.to_strand()));\n\t\t\t\t}\n\t\t\t\t\"dirpath\" | \"dirname\" => {\n\t\t\t\t\tif let Some(p) = f.content_path().parent() {\n\t\t\t\t\t\ts.extend_from_slice(&form.separator.transform(&p));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\"dirurl\" => {\n\t\t\t\t\tif let Some(p) = f.url.parent() {\n\t\t\t\t\t\ts.extend_from_slice(&form.separator.transform(&p.to_strand()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\"filename\" => {\n\t\t\t\t\ts.extend_from_slice(&form.separator.transform(&f.name().unwrap_or_default()));\n\t\t\t\t}\n\t\t\t\t\"name_without_ext\" => {\n\t\t\t\t\ts.extend_from_slice(&form.separator.transform(&f.stem().unwrap_or_default()));\n\t\t\t\t}\n\t\t\t\t_ => bail!(\"Unknown copy type: {}\", form.r#type),\n\t\t\t};\n\t\t\tif it.peek().is_some() {\n\t\t\t\ts.push(b'\\n');\n\t\t\t}\n\t\t}\n\n\t\t// Copy the CWD path regardless even if the directory is empty\n\t\tif s.is_empty() && matches!(&*form.r#type, \"dirpath\" | \"dirname\") {\n\t\t\ts.extend_from_slice(&form.separator.transform(&cx.current().content_path()));\n\t\t} else if s.is_empty() && form.r#type == \"dirurl\" {\n\t\t\ts.extend_from_slice(&form.separator.transform(&cx.cwd().to_strand()));\n\t\t}\n\n\t\tfutures::executor::block_on(CLIPBOARD.set(s));\n\t\tsucc!();\n\t}\n}\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/sxyazi/yazi/blob/a541adde4e5b082719a0f21a87eb3eab071ece58/yazi-actor/src/mgr/copy.rs#L33-L69","documentation":"The `copy` command in Yazi's manager assembles copied text per selected file based on a copy type (`form.r#type`). Any type other than the recognized ones (e.g. \"filename\", \"name_without_ext\", plus built-ins like \"path\", \"dirname\", \"url\") hits the catch-all branch and bails with this message naming the offending type.","triggerScenarios":"Invoking the `copy` action/plugin with an unrecognized `type` value in its form, e.g. `plugin copy -- sync ...` with a misspelled or unsupported type string.","commonSituations":"Typo in a keymap command (e.g. `copy filenamee`); using a type removed or renamed in a newer Yazi version; custom plugin calling the manager copy API with an invalid type.","solutions":["Check the copy type in the keymap/plugin call against Yazi's docs and fix the spelling (valid types: filename, name_without_ext, path, dirname, etc.).","Upgrade/downgrade Yazi if the type was renamed between versions.","If writing a plugin, extend the match in yazi-actor/src/mgr/copy.rs to handle the new type before using it."],"exampleFix":"// before (keymap.toml)\n{ on = [ \"c\", \"n\" ], run = \"copy filenamee\" }\n\n// after\n{ on = [ \"c\", \"n\" ], run = \"copy filename\" }","handlingStrategy":"validation","validationCode":"local valid = { path = true, filename = true, name_without_ext = true, dirname = true }\nlocal ok = valid[args.type]\nif not ok then error(\"invalid copy type: \" .. tostring(args.type)) end","typeGuard":"local function is_valid_copy_type(t)\n  return t == \"path\" or t == \"filename\" or t == \"name_without_ext\" or t == \"dirname\"\nend","tryCatchPattern":"local ok, err = pcall(function() Command(\"copy\"):arg({ \"--\", form_type }):send() end)\nif not ok then ya.notify({ title = \"copy failed\", content = err, level = \"error\" }) end","preventionTips":["Keep keymap copy commands in sync with the documented set of copy types.","After upgrading Yazi, re-check keymap.toml for renamed copy types.","Validate user-supplied type strings in custom plugins before dispatching."],"tags":["plugin","keymap","invalid-argument","copy"],"backgroundTag":"invalid-enum-value","analyzedSha":"a541adde4e5b082719a0f21a87eb3eab071ece58","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}