{"record":{"id":"0a33d7463d2b6cf8","repo":"forem/forem","slug":"invalid-mux-url","errorCode":null,"errorMessage":"Invalid Mux URL.","messagePattern":"Invalid Mux URL\\.","errorType":"exception","errorClass":"StandardError","httpStatus":null,"severity":"error","filePath":"app/liquid_tags/mux_tag.rb","lineNumber":33,"sourceCode":"  end\n\n  def render(_context)\n    ApplicationController.render(\n      partial: PARTIAL,\n      locals: {\n        id: @id,\n        width: @width,\n        height: @height\n      },\n    )\n  end\n\n  private\n\n  def extract_video_id(input)\n    input_params_removed = input.split(\"?\")[0] # Remove query params for validation\n    match = pattern_match_for(input_params_removed, [REGISTRY_REGEXP])\n    raise StandardError, I18n.t(\"liquid_tags.mux_tag.invalid_mux_url\") unless match\n\n    match[:video_id]\n  end\nend\n\nUnifiedEmbed.register(MuxTag, regexp: MuxTag::REGISTRY_REGEXP, skip_validation: true)\n\n","sourceCodeStart":15,"sourceCodeEnd":41,"githubUrl":"https://github.com/forem/forem/blob/f354c376a7c5d1330dc40d66f150be8d1289020d/app/liquid_tags/mux_tag.rb#L15-L41","documentation":"The {% mux %} input (strip_tags + entity unescape) has its query string removed via split('?').first and must match https://player.mux.com/<video_id> where video_id is [a-zA-Z0-9_-]+ (optionally followed by a well-formed query before stripping). Otherwise the tag raises 'Invalid Mux URL.'. Note UnifiedEmbed registers MuxTag with skip_validation: true, so the {% embed %} path performs no pre-validation — this check inside the tag is the only guard.","triggerScenarios":"A non-player.mux.com host (share.mux.com, mux.com dashboard links); a missing video id; an id containing characters outside [a-zA-Z0-9_-]; URLs where removal of '?...' leaves an empty or malformed path.","commonSituations":"Pasting the Mux dashboard or share.mux.com asset URL instead of the player URL; percent-encoded characters that survive unescaping.","solutions":["Use the player URL: https://player.mux.com/<video_id>","Copy the playback link from the Mux asset's embed/player panel","Keep the id to alphanumerics, dashes and underscores"],"exampleFix":"// before\n{% mux https://mux.com/assets/abc123 %}\n\n// after\n{% mux https://player.mux.com/abc123 %}","handlingStrategy":"validation","validationCode":"def valid_mux_url?(raw)\n  MuxTag::REGISTRY_REGEXP.match?(raw.split('?').first.to_s)\nend","typeGuard":null,"tryCatchPattern":"begin\n  Liquid::Template.parse(markdown).render\nrescue StandardError => e\n  [e.message]\nend","preventionTips":["Remember {% embed %} does NOT pre-validate Mux (skip_validation: true) — always lint the player URL yourself","Normalize to https://player.mux.com/<id> at input time"],"tags":["liquid-tag","mux","url-validation","video-embed","forem"],"backgroundTag":"invalid-embed-url","analyzedSha":"f354c376a7c5d1330dc40d66f150be8d1289020d","analyzedAt":"2026-08-21T12:43:44.428Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}