{"record":{"id":"0e235812a29947da","repo":"openjdk/jdk","slug":"s-d-internal-error-sysex-message-status-0x-x","errorCode":null,"errorMessage":"%s: %d->internal error: sysex message status=0x%X while sending short message\n","messagePattern":"(.+?): (.+?)->internal error: sysex message status=0x%X while sending short message\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_MidiOut.c","lineNumber":130,"sourceCode":"        case 0x90:    // Note on\n        case 0xA0:    // Aftertouch\n        case 0xB0:    // Controller\n        case 0xE0:    // Pitch wheel\n            nData = 3;\n            break;\n\n        case 0xC0:    // Program change\n        case 0xD0:    // Channel pressure\n            nData = 2;\n            break;\n\n        case 0xF0: {\n            // System common message\n            switch (data[0]) {\n                case 0xF0:\n                case 0xF7:\n                    // System exclusive\n                    fprintf(stderr, \"%s: %d->internal error: sysex message status=0x%X while sending short message\\n\",\n                            __FILE__, __LINE__, data[0]);\n                    byteIsInvalid = TRUE;\n                    break;\n\n                case 0xF1:    // MTC quarter frame message\n                    //fprintf(stderr, \">>>MIDI_OUT_SendShortMessage: MTC quarter frame message....\\n\");\n                    nData = 2;\n                    break;\n                case 0xF3:    // Song select\n                    //fprintf(stderr, \">>>MIDI_OUT_SendShortMessage: Song select....\\n\");\n                    nData = 2;\n                    break;\n\n                case 0xF2:    // Song position pointer\n                    //fprintf(stderr, \">>>MIDI_OUT_SendShortMessage: Song position pointer....\\n\");\n                    nData = 3;\n                    break;\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_MidiOut.c#L112-L148","documentation":"macOS Java Sound MIDI output: while translating a 'short' MIDI message for CoreMIDI (MIDISend), the status byte is 0xF0 or 0xF7 — System Exclusive start/escape bytes, which cannot travel through the short-message API (they require packet-list streaming of arbitrary-length sysex data). The code prints this internal error (with file/line), marks the byte invalid, and the message is not sent.","triggerScenarios":"Calling ShortMessage.setMessage / Receiver.send with a ShortMessage whose status byte is 0xF0 (SysEx start) or 0xF7 (SysEx escape) on the macOS MIDI-Out implementation: e.g. setMessage(0xF0, ...) or constructing a SysexMessage-like payload through the short-message path.","commonSituations":"Porting MIDI code from other platforms or from javax.sound.midi SysexMessage misuse — sending sysex data as a ShortMessage; libraries that pack arbitrary bytes into ShortMessage; device discovery code probing with raw status bytes.","solutions":["Use javax.sound.midi.SysexMessage (status 0xF0/0xF7 payloads) instead of ShortMessage for system-exclusive data — the macOS implementation will stream it correctly","Validate the status byte before sending: reject/complain about 0xF0/0xF7 in the short-message path","If a library you depend on sends raw sysex via ShortMessage, patch it or upgrade to a version using SysexMessage","Check the printed file/line/status to confirm which message was dropped and fix the sender accordingly"],"exampleFix":"// before\nShortMessage msg = new ShortMessage();\nmsg.setMessage(0xF0, 0x7E, 0x7F); // invalid: sysex start via short message\nreceiver.send(msg, -1);\n\n// after\nSysexMessage msg = new SysexMessage(new byte[]{(byte)0xF0, 0x7E, 0x7F, (byte)0xF7}, 4);\nreceiver.send(msg, -1);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Guard the short-message send path against sysex status bytes:\nstatic boolean isShortMessageStatus(int status) {\n    return status >= 0x80 && status != 0xF0 && status != 0xF7; // 0xF0/0xF7 need SysexMessage\n}\n\nif (!isShortMessageStatus(msg.getStatus())) {\n    throw new IllegalArgumentException(\"sysex status 0x\" + Integer.toHexString(msg.getStatus())\n        + \" must be sent via SysexMessage, not ShortMessage\");\n}\nreceiver.send(msg, timeStamp);","tryCatchPattern":null,"preventionTips":["Model the MIDI API correctly in client code: ShortMessage for channel/common messages, SysexMessage for 0xF0/0xF7 payloads","Add the type guard above around any Receiver.send boundary that receives messages from untrusted/user input"],"tags":["java-desktop","javasound","midi","macos","validation"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}