Debugging a failed DICOM association: A-ASSOCIATE-RJ
- An A-ASSOCIATE-RJ packet carries Result, Source, and Reason bytes that explain why an association failed.
- Calling or Called AE title mismatches cause the majority of real-world association rejections.
- An A-ABORT is an emergency stop that can occur at any point, unlike the negotiated A-ASSOCIATE-RJ refusal.
- tcpdump and Wireshark can decode the raw 10-byte rejection PDU to confirm the exact failure cause.
- Packet analysis only works on unencrypted traffic; TLS connections require server-side logs instead.
When a DICOM association fails before image transfer starts, the receiving peer sends an A-ASSOCIATE-RJ packet or terminates the socket with an A-ABORT. The rejection packet carries three numeric fields: Result, Source, and Reason. Reading these three bytes tells you whether the server rejected your Called AE Title, refused an abstract syntax, or ran out of local resources.
Many Picture Archiving and Communication System (PACS) servers print vague error messages in their user interface. A status line like “Association failed” hides the real problem. You can find the true root cause within minutes by reading the raw protocol bytes.
Why was your DICOM association rejected with A-ASSOCIATE-RJ?
Every classic DICOM transaction starts with an association handshake. Before an imaging modality sends a C-STORE or runs a DICOM C-ECHO verification test, it opens a TCP connection. Next, it sends an A-ASSOCIATE-RQ Protocol Data Unit (PDU).
That request contains the network identity of both peers. It lists the Calling Application Entity (AE) title of the sender and the Called AE title of the listener. It also proposes one or more presentation contexts. Each context pairs an abstract syntax (the SOP Class) with one or more transfer syntaxes (the encoding rules).
The Service Class Provider (SCP) evaluates this proposal against its local configuration. If everything matches, it returns an A-ASSOCIATE-AC (Associate Acknowledge) packet. Transfer begins immediately.
SCU (Client) SCP (Server)
| |
|----------- 1. TCP Handshake (SYN/ACK) ------>|
| |
|----------- 2. A-ASSOCIATE-RQ --------------->|
| (Calling AE, Called AE, Contexts) |
| |
| [ SCP checks AE rules & syntaxes ] |
| |
|<---------- 3. A-ASSOCIATE-RJ ----------------|
| (Result, Source, Reason bytes) |
| |
|----------- 4. TCP FIN/RST ------------------>|
If the server refuses the connection, it returns an A-ASSOCIATE-RJ (Associate Reject) PDU. It then closes the TCP connection. The rejection happens at the DICOM Upper Layer protocol before any medical datasets touch the wire.
When you configure a receiver, such as an external listener behind DICOM listener endpoints, association negotiation enforces access boundaries. It ensures that only known senders reach the application layer.
Decoding the A-ASSOCIATE-RJ packet: Result, Source, and Reason
An A-ASSOCIATE-RJ packet is small. Section 9.3.4 of DICOM PS3.8 defines its 10-byte structure:
- Bytes 1–6: Header (
03Hfor A-ASSOCIATE-RJ, one reserved byte, and length fixed at00000004H). - Byte 7: Reserved (
00H). - Byte 8: Result (
1=rejected-permanent,2=rejected-transient). - Byte 9: Source (
1=service-user,2=service-provider ACSE,3=service-provider Presentation). - Byte 10: Reason / Diagnosis.
The Result byte indicates whether retrying will help. A permanent rejection (1) means a configuration error that retries cannot fix. A transient rejection (2) points to temporary resource pressure, such as an exhausted worker pool.
The Source byte identifies which stack layer issued the rejection. Reason codes map directly to the Source:
| Source | Reason code | Name | Common root cause |
|---|---|---|---|
service-user (1) |
1 |
no-reason-given |
Generic rejection without specific diagnostic detail. |
service-user (1) |
2 |
app-context-not-supported |
Invalid or unsupported Application Context Name UID. |
service-user (1) |
3 |
calling-AE-not-recognized |
The server whitelist blocked your Calling AE title. |
service-user (1) |
7 |
called-AE-not-recognized |
The destination Called AE title does not match the server. |
service-provider, ACSE (2) |
1 |
no-reason-given |
The ACSE protocol layer refused the negotiation. |
service-provider, ACSE (2) |
2 |
protocol-version-not-supported |
Incompatible Upper Layer protocol version (expects version 1). |
service-provider, Presentation (3) |
1 |
temporary-congestion |
The server exhausted internal buffers or worker threads. |
service-provider, Presentation (3) |
2 |
local-limit-exceeded |
The server reached its concurrent association ceiling. |
Codes 3 and 7 under service-user cause over 80 percent of real-world rejections. If you see Result 1, Source 1, and Reason 7, verify your destination AE title first. Remember that DICOM Application Entity (AE) titles are case-sensitive strings up to 16 characters long.
Why did the association drop with an A-ABORT?
Sometimes you will not receive an A-ASSOCIATE-RJ at all. Instead, the remote peer abruptly sends an A-ABORT PDU and closes the socket.
An A-ASSOCIATE-RJ is a polite refusal during negotiation. An A-ABORT is an emergency stop. A peer can issue an abort at any moment during negotiation or during active dataset streaming.
DICOM PS3.8 Section 9.3.8 defines the 10-byte A-ABORT PDU. Byte 1 is 07H. Byte 9 identifies the abort Source: 0 for service-user (application abort) and 2 for service-provider (protocol state machine abort).
Byte 10 provides the Reason code when Source is 2:
| Reason code | Diagnostic name | Wire meaning |
|---|---|---|
0 |
reason-not-specified |
Provider aborted without detailed error. |
1 |
unrecognized-PDU |
Received an unknown PDU type byte. |
2 |
unexpected-PDU |
Received a PDU out of sequence. |
4 |
unrecognized-PDU-parameter |
Header parameter was corrupt or unreadable. |
5 |
unexpected-PDU-parameter |
Parameter arrived in an invalid order. |
6 |
invalid-PDU-parameter-value |
Field length or value exceeded protocol limits. |
When Source is 0 (service-user), Byte 10 carries no diagnostic meaning. Applications send 00H. An application abort never explains itself on the wire.
Why do servers abort associations? Four reasons dominate:
- Socket read timeouts during slow network transfers.
- Disk-full errors when writing incoming datasets.
- TLS certificate validation failures on mTLS links.
- Process crashes in the remote DICOM daemon.
When investigating an A-ABORT, inspect server application logs. The network packet only records that someone hung up the phone.
Reproducing rejections locally with DCMTK
You can reproduce and test these failure modes on your own workstation using DCMTK. We tested the commands below using DCMTK version 3.7.0.
First, start a test receiver using dcmrecv on port 42104. Set its local AE title to TARGET_SCP:
dcmrecv -v -d -aet TARGET_SCP 42104
In a second terminal, attempt a verification ping using echoscu. Intentionally supply the wrong destination AE title (-aec WRONG_SCP):
echoscu -v -d -aec WRONG_SCP 127.0.0.1 42104
The receiver rejects the handshake immediately. Look at the output from echoscu:
I: Requesting Association
D: Constructing Associate RQ PDU
F: Association Rejected:
F: Result: Rejected Permanent, Source: Service User
F: Reason: Called AE Title Not Recognized
Notice how echoscu translates the raw wire values for you. It received Result 1, Source 1, Reason 7.
Now test what happens when the listener refuses all incoming connections. Stop dcmrecv and start storescp with the --refuse flag on the same port:
storescp -v -d --refuse 42104
Run echoscu again:
echoscu -v -d 127.0.0.1 42104
The output changes:
I: Requesting Association
D: Constructing Associate RQ PDU
F: Association Rejected:
F: Result: Rejected Permanent, Source: Service User
F: Reason: No Reason
Here the server returned Result 1, Source 1, Reason 1 (no-reason-given). This happens when hospital firewalls or DICOM gateways deliberately hide their internal configuration from unauthorized callers.
You can learn more about verifying endpoints with DCMTK in our guide to DCMTK commands for developers.
Capturing association traffic with tcpdump
Vendor logs often omit the Reason code. When that happens, capture the network packets directly.
Packet captures reveal the exact bytes exchanged on the wire. You can capture DICOM traffic on Linux or macOS using tcpdump.
Run tcpdump on your server interface. Listen on standard DICOM port 104 or a test port:
tcpdump -i any -nn -s 0 -w dicom_reject.pcap "tcp port 104 or tcp port 42104"
The flags ensure clean capture:
-i any: Captures across all network interfaces.-nn: Disables DNS and port name lookups.-s 0: Captures full packets without truncation.-w dicom_reject.pcap: Writes raw packets to disk.
Run your connection test while tcpdump runs. Once the association fails, stop the capture with Ctrl+C.
Inspect the capture in your terminal using -X to print hex and ASCII:
tcpdump -nn -X -r dicom_reject.pcap "tcp[tcpflags] & tcp-push != 0"
Look for the 10-byte A-ASSOCIATE-RJ packet in the hex dump:
03 00 00 00 00 04 00 01 01 07
Reading left to right:
03: PDU type 3 (A-ASSOCIATE-RJ).00 00 00 04: 4-byte payload length (after the reserved byte).00: Reserved byte.01: Result (rejected-permanent).01: Source (service-user).07: Reason (called-AE-title-not-recognized).
Those 10 bytes prove the root cause. The remote application received the request and rejected your Called AE title.
Inspecting DICOM PDUs in Wireshark
Wireshark provides a faster visual workflow with its built-in DICOM protocol dissector.
Open your .pcap file in Wireshark. If your traffic ran over a non-standard port like 42104, Wireshark might display the packets as plain TCP.
To fix this:
- Right-click any packet in the stream.
- Select Decode As….
- Set the Current column to DICOM.
- Click OK.
Wireshark parses the binary payload into DICOM Upper Layer structures:
DICOM Protocol
PDU Type: A-ASSOCIATE-RJ (0x03)
PDU Length: 4
Result: 1 (Rejected Permanent)
Source: 1 (DICOM UL service-user)
Reason: 7 (Called AE title not recognized)
You can filter large captures using Wireshark display filters:
dicom.assoc.reject: Shows only association rejection packets.dicom.assoc.reject.result == 1: Filters for permanent rejections.dicom.assoc.reject.reason == 7: Isolates Called AE title rejections.dicom.assoc.abort: Finds allA-ABORTpackets.dicom.pdu.type == 0x01: Isolates initialA-ASSOCIATE-RQrequests.
Expand the packet details. Wireshark shows human-readable names for Result, Source, and Reason alongside the Calling AE title and presentation contexts from the preceding A-ASSOCIATE-RQ.
Keep one limitation in mind: packet analysis requires unencrypted traffic. On TLS connections, Wireshark only displays encrypted records. To debug TLS failures, inspect server logs directly or configure an SSL key log file.
Practical checklist for association failures
Work through these diagnostic checks in order:
- Verify TCP reachability. Run
nc -zv <host> <port>or test withechoscu. If the TCP handshake fails, check firewall rules and routing first. - Double-check AE titles. Make sure the Calling AE title matches the remote whitelist. Confirm that your Called AE title matches the listener. Remember that trailing spaces and letter casing matter.
- Inspect SOP Classes and Transfer Syntaxes. If the server returns
A-ASSOCIATE-ACbut marks presentation contexts as rejected, read our guide on DICOM SOP Classes and Transfer Syntaxes. - Check Maximum PDU length. Some older modalities crash or reject associations if the proposed Maximum PDU Receive Size exceeds 16,384 bytes (
16 KB). - Review server concurrency. If you receive Reason
1or2under Presentation Source (rejected-transient), the server has exhausted its worker connections.
When preparing a new modality connection, follow our practical guide on how to connect an imaging sender to prevent configuration mismatches before going live.
Dicomly builds infrastructure for healthcare software teams that receive DICOM studies from hospitals. Why we built Dicomly →