{"record":{"id":"509be44cb8d3d5ca","repo":"WordPress/WordPress","slug":"invalid-action-value-use-either-copy-or-cut","errorCode":null,"errorMessage":"Invalid \"action\" value, use either \"copy\" or \"cut\"","messagePattern":"Invalid \"action\" value, use either \"copy\" or \"cut\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"wp-includes/js/clipboard.js","lineNumber":161,"sourceCode":"\n\n/**\n * Inner function which performs selection from either `text` or `target`\n * properties and then executes copy or cut operations.\n * @param {Object} options\n */\n\nvar ClipboardActionDefault = function ClipboardActionDefault() {\n  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  // Defines base properties passed from constructor.\n  var _options$action = options.action,\n      action = _options$action === void 0 ? 'copy' : _options$action,\n      container = options.container,\n      target = options.target,\n      text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'.\n\n  if (action !== 'copy' && action !== 'cut') {\n    throw new Error('Invalid \"action\" value, use either \"copy\" or \"cut\"');\n  } // Sets the `target` property using an element that will be have its content copied.\n\n\n  if (target !== undefined) {\n    if (target && _typeof(target) === 'object' && target.nodeType === 1) {\n      if (action === 'copy' && target.hasAttribute('disabled')) {\n        throw new Error('Invalid \"target\" attribute. Please use \"readonly\" instead of \"disabled\" attribute');\n      }\n\n      if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {\n        throw new Error('Invalid \"target\" attribute. You can\\'t cut text from elements with \"readonly\" or \"disabled\" attributes');\n      }\n    } else {\n      throw new Error('Invalid \"target\" value, use a valid Element');\n    }\n  } // Define selection strategy based on `text` property.\n\n","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/WordPress/WordPress/blob/f37eb7ab386ba0785b153f64c9c4451a8df9d9e3/wp-includes/js/clipboard.js#L143-L179","documentation":"Error \"Invalid \"action\" value, use either \"copy\" or \"cut\"\" thrown in WordPress/WordPress.","triggerScenarios":"Thrown at wp-includes/js/clipboard.js:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f37eb7ab386ba0785b153f64c9c4451a8df9d9e3","analyzedAt":"2026-08-17T02:58:14.809Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}