View Issue Details

IDProjectCategoryView StatusLast Update
0009967ardourbugspublic2025-08-14 17:47
Reportercallynsky Assigned To 
PriorityurgentSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformUbuntuOSLinuxOS Version(any)
Product Version8.12 
Summary0009967: Ardour 8.x: MissingActionException for Lua action Script<nav>/man called from MIDI map – parser does not recognize the action
Description[ARDOUR BUG REPORT]

Submission Date: 2025-08-12
Environment:
  - Operating System: Ubuntu 25.04 (Plucky Puffin)
  - Ardour Version: 8.x
  - MIDI Controller: Zoom R8
  - Configuration: Controller configured as General MIDI in the Control Surfaces section
  - MIDI map configuration files and Lua scripts located in the user directory (~/.config/ardour8/)

Problem Description:
When attempting to call a Lua script defined in the file `man.lua` via MIDI message (note 54) on the Zoom R8 controller, bound in the MIDI map file `zoom_r8_custom.map`, an error "MissingActionException" appears, indicating that Ardour does not recognize the action.

The officially recommended format for calling a Lua action in the MIDI map file is:
action="Script<nav>/man"
which in XML is encoded with `<` and `>` characters corresponding to the category "nav" and the action name "man".

In Ardour 8.x in practice:
- Using the above format causes the error message:
  "missing action: Script<nav>/man"
  even though the script is correctly loaded and visible in the script manager and keyboard shortcuts.

- Attempts to use simplified variants in the MIDI map:
  - action="Scriptnav/man"
  - action="Script_nav/man"
  still lead to the same MissingActionException error indicating the action is missing.

Diagnostics and attempts to rule out errors:
- The `.map` and `.lua` files were checked with the commands `cat -A`, `hexdump`, and cleaned with a special "clean lua" script to remove hidden characters, formatting errors, or invisible spaces.
- The action named `man` in the category `nav` is correctly declared in the Lua script and is visible and accessible both in the script manager and keyboard shortcuts, where it works properly (the log shows the message `LuaInstance: man action triggered`).
- MIDI messages from the Zoom R8 are received correctly, as confirmed by the tools `aseqdump` and MIDI Tracer.
- Bindings to Ardour's built-in functions in the `zoom_r8_custom.map` file work correctly without producing errors.
- After every change of the map or script, Ardour is restarted and the MIDI maps are manually reloaded.
- Both the official format `Script<nav>/man` and simplified variants (`Scriptnav/man` and `Script_nav/man`) were tested to exclude the influence of formatting on action recognition.
- Variants of calling Lua actions from previous versions of Ardour were also tested, but these also resulted in the `MissingActionException` error.

Contents of the MIDI map file (`zoom_r8_custom.map`):

<?xml version="1.0" encoding="UTF-8"?>
<ArdourMIDIBindings version="1.0.0" name="ZOOM R8 Custom">
 <Binding channel="1" note="95" action="Transport/Record"/>
 <Binding channel="1" note="94" function="transport-roll"/>
 <Binding channel="1" note="93" function="transport-stop"/>
 <Binding channel="1" note="92" function="transport-roll"/>
 <Binding channel="1" note="91" action="Transport/Rewind"/>
 <Binding channel="1" note="55" action="Transport/Loop"/>
 <Binding channel="1" note="54" action="Script<nav>/man"/>
</ArdourMIDIBindings>

Contents of the Lua script (`man.lua`):

ardour {
  type = "EditorAction",
  name = "man",
  license = "pk",
  author = "pk",
  category = "nav",
  description = [[Go to start of session and log a message]]
}

function factory ()
  return function ()
    print("man action triggered")
    Session:goto_start()
  end
end

Summary:
Despite correct loading and visibility of the Lua script, as well as correct operation of other MIDI-mapped actions, calling Lua actions via MIDI map results in the "MissingActionException" error regardless of the action name format. This problem appears specific to the MIDI map parser in Ardour version 8.x and requires further diagnosis and fixing.

[END OF REPORT]
TagsNo tags attached.

Activities

x42

2025-08-12 14:12

administrator   ~0029376

> The officially recommended format for calling a Lua action in the MIDI map file is: action="Script<nav>/man"

Where does that information come from?

https://manual.ardour.org/appendix/menu-actions-list/ has "LuaAction/script-1", "LuaAction/script-2", "LuaAction/script-3" etc
Have you tried that?

callynsky

2025-08-12 23:43

reporter   ~0029377

Subject: Explanation of the XML error when calling a Lua action in an Ardour MIDI map

During tests of MIDI map configuration in Ardour 8.x, an XML parsing error appeared in the application logs:

XML error: Unescaped '<' not allowed in attributes values ...
...
Opening and ending tag mismatch: nav line 9 and ArdourMIDIBindings ...

Cause of the error:
- The format of MIDI map files (*.map) in Ardour is based on XML syntax.
- In XML, the characters < and > cannot be used directly in attribute values, because the parser interprets <...> as a tag.
- Attempting to enter the value in the `action` attribute as Script<nav>/man causes the XML parser to treat `<nav>` as a tag, which results in an error even before Ardour processes it.
- Additionally, in the analyzed file, the final part of the action name and the tag closure were missing, which caused XML syntax errors.

Correct format:

According to XML rules, attribute values must use entity encoding:
- `<` as `<`
- `>` as `>`

For a Lua action named "man" in the category "nav", the correct entry in the MIDI map file is:

<Binding channel="1" note="54" action="Script<nav>/man"/>

Source of information and additional explanation:
- The requirement to encode `<` and `>` in XML files comes from general XML syntax rules and not directly from the Ardour Lua Scripting documentation.
- The official Ardour documentation for Lua Scripting describes the action name format as Script<category>/name in the Action Manager and shortcut assignments, but does not explicitly instruct to use XML entities for `<` and `>` in MIDI map files.
- This encoding practice is based on general XML rules and is commonly used when editing `.map` files in Ardour.
- The official Ardour manual on Lua Scripting can be found at:
  https://manual.ardour.org/lua-scripting/

Conclusion and recommendation:
Correcting the entry in the `zoom_r8_custom.map` file according to the above example eliminates the XML error and allows Ardour to correctly recognize and execute the Lua action from the MIDI map.

callynsky

2025-08-13 11:52

reporter   ~0029378

I would like to supplement the previous answer with an explanation of where the rest of the syntax in the `action` attribute comes from, apart from the need to replace angle brackets with an XML-safe notation.

1. Source of the `Script<category>/name` format:
   - This format comes from the way Lua actions are registered in Ardour.
   - In every Lua script, inside the `ardour { ... }` metadata block, we define, among other things:
     ardour {
       type = "EditorAction",
       name = "man",
       category = "nav",
       ...
     }
   - After loading, Ardour registers such an action in the Action Manager as:
     Script<nav>/man
     The “Script” prefix indicates that the action comes from Lua, and `category` and `name` are taken directly from the metadata in the script.

2. Why the entry in `.map` looks different:
   - In Ardour’s graphical interface, the action name appears as:
     Script<nav>/man
   - In the `.map` file (which is XML), the “less than” and “greater than” signs **cannot be written directly**. They must be written as XML entities.
   - **How to write the XML entity in descriptive form**:
     • For the “less than” sign: write the ampersand (`&`), the letters **lt**, and a semicolon (`;`).
     • For the “greater than” sign: write the ampersand (`&`), the letters **gt**, and a semicolon (`;`).
   - Applying these notations in the action name, the example looks like:
     <Binding channel="1" note="54" action="Script[here insert the 'less than' entity]nav[here insert the 'greater than' entity]/man"/>

3. Summary:
   The final `action` entry in the `.map` file results from combining:
   - The `Script<category>/name` naming convention from the Lua Scripting documentation.
   - The requirement from the MIDI Binding Maps documentation to put the full action name in the `action` attribute.
   - The general XML rules requiring the use of entities for `<` and `>`.

Sources:
- Lua Scripting Manual: https://manual.ardour.org/lua-scripting/
- MIDI Binding Maps Manual: https://manual.ardour.org/using-control-surfaces/generic-midi/midi-binding-maps/

Issue History

Date Modified Username Field Change
2025-08-12 10:19 callynsky New Issue
2025-08-12 14:12 x42 Note Added: 0029376
2025-08-12 23:43 callynsky Note Added: 0029377
2025-08-13 11:52 callynsky Note Added: 0029378