Fusion API (Python): SplitButtonControl.defaultCommandDefinition raises InternalValidationError: items.size() on QAT Undo controls

Fusion API (Python): SplitButtonControl.defaultCommandDefinition raises InternalValidationError: items.size() on QAT Undo controls

arthur_sausin
Community Visitor Community Visitor
91 Views
0 Replies
Message 1 of 1

Fusion API (Python): SplitButtonControl.defaultCommandDefinition raises InternalValidationError: items.size() on QAT Undo controls

arthur_sausin
Community Visitor
Community Visitor

Hello Autodesk Fusion API team,

We need guidance on reading split-button command references and safely removing
an add-in's own command definitions. A read-only UI preflight encountered the
following exception before the add-in created any UI resources:

RuntimeError: 2 : InternalValidationError : items.size()

The failing Python property is adsk.core.SplitButtonControl.defaultCommandDefinition.
The final SDK frame in the observed trace is:

core.py, line 42035, _get_defaultCommandDefinition
    return _core.SplitButtonControl__get_defaultCommandDefinition(self)
RuntimeError: 2 : InternalValidationError : items.size()

Environment and observed facts:

  • Fusion 2705.1.30, Windows. The application log identifies this version and
    contains all four relevant add-in start entries. Its OS-version field is 10.0;
    the exact Windows build and embedded Python patch version were not recorded.
  • Four attempts were observed on 29 October 2026: one first failure on
    QAT / UndoDropDown, then three on QAT / ElectronUndo.
  • Each control passed the isValid is True and SplitButtonControl type checks.
    additionalDefinitions returned an adsk.core.CommandDefinitionVector of
    length zero. Reading defaultCommandDefinition then raised the exception.
  • The failing call was synchronous in add-in startup, before UI allocation,
    document creation or any geometric engine call. No worker/custom event was
    involved in this read. Startup was refused; this is not a successful STOP test.
  • The four application-log start times align with the four lifecycle-file mtimes
    within five seconds. Lifecycle records lack their own application version and
    event timestamps, so this is cross-log attribution, not a shared event ID.

A separate earlier read-only probe in the same Fusion version successfully read
ElectronicDesign::NavToolbar / ZoomFitCommandGroup: its default was the valid
native ZoomWindowViewCommand, and its additional Vector contained valid native
FitCommand. This is a different control/context. We have already handled the
Vector representation; the present issue is the default-definition getter.

Expected: a documented CommandDefinition result, or documented handling for a
control whose default is unavailable. Observed: the native getter raises before
returning a definition. We do not interpret that exception, or an empty additional
list, as proof that no command is referenced.

The attachment includes a small standalone Python script, QATDefaultReadProbe,
with no dependency on our add-in. Its essential lookup is:

qat = app.userInterface.toolbars.itemById('QAT')
control = qat.controls.itemById('UndoDropDown')  # also ElectronUndo
additional = control.additionalDefinitions
default = control.defaultCommandDefinition

The script records both targeted reads independently and preserves unknown/error
states. It creates no commands, handlers, documents, palettes or workers, calls
no deletion methods and prints only a small JSON diagnostic. It is prepared
and tested with offline doubles, but has not yet been executed natively
.
The original add-in failure is observed; a fresh-install standalone reproduction
is not claimed. The script entry point also differs from add-in startup.

Our local screenshots (not attached) show a Design workspace and an unsaved document. Undo history,
isLastUsedShown, and ownership of the failing splits were not measured. Other
add-ins were active, but no causal link or concurrent UI mutation is established.
Only the first blocking read is known for each attempt. Empty undo history,
context-dependent availability and an SDK defect remain hypotheses.

Could you clarify:

  1. What does InternalValidationError: items.size() mean for these two QAT
    controls? Is this an expected unavailable-default state, or a defect?
  2. Is there a documented way to inspect the default/reference state without
    provoking this exception, or to distinguish absence from an unreadable value?
  3. What supported API/contract can establish that no foreign control retains an
    add-in-owned CommandDefinition at STOP, including split defaults, additional
    definitions, last-used behavior and user-pinned controls? In particular, can a
    command remain referenced after removal from additionalDefinitions?
  4. What creation/removal pattern is recommended when only resources directly
    created by the add-in may be changed? Does CommandDefinition.deleteMe() affect
    foreign controls that reference it, and what postconditions can be verified?

The UI customization guide recommends deleting an add-in's definitions and
controls on unload. The UI inventory sample catches a failed default getter and
records an error. We understand that an incomplete diagnostic inventory is not,
by itself, proof that deleting a shared definition preserves foreign resources.
We are seeking a supported cleanup contract, without name-based exclusions or
treating unknown references as safe. Retaining definitions after STOP is outside
our approved lifecycle contract.

Attachments: OBSERVED_FACTS.json, QATDefaultReadProbe/, REPRODUCTION.md,
REFERENCES.md. They contain no user model, personal path, account identifier,
raw application log or private add-in identifier.

Thank you.

0 Likes
92 Views
0 Replies
Replies (0)