question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid 'Called AE Title' value 'LWPACS' - must not contain control characters or backslashes

See original GitHub issue

python3 -m pynetdicom echoscu 10.10.10.120 4445 -aec LWPACS -aet ydcfserver

E: Invalid 'Called AE Title' value 'LWPACS' - must not contain control characters or backslashes
E: State Machine received an exception attempting to perform the action 'AE-3' while in state 'Sta5'
E: Invalid 'Called AE Title' value 'LWPACS' - must not contain control characters or backslashes
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/fsm.py", line 90, in do_action
    next_state = action[1](self.dul)
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/fsm.py", line 232, in AE_3
    dul.to_user_queue.put(cast("A_ASSOCIATE", pdu.to_primitive()))
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/pdu.py", line 899, in to_primitive
    primitive.called_ae_title = self.reserved_aet
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/pdu_primitives.py", line 206, in called_ae_title
    str, set_ae(value, "Called AE Title", False, False)
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/utils.py", line 199, in set_ae
    raise ValueError(msg)
ValueError: Invalid 'Called AE Title' value 'LWPACS' - must not contain control characters or backslashes
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/dul.py", line 445, in run_reactor
    self.state_machine.do_action(event)
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/fsm.py", line 90, in do_action
    next_state = action[1](self.dul)
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/fsm.py", line 232, in AE_3
    dul.to_user_queue.put(cast("A_ASSOCIATE", pdu.to_primitive()))
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/pdu.py", line 899, in to_primitive
    primitive.called_ae_title = self.reserved_aet
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/pdu_primitives.py", line 206, in called_ae_title
    str, set_ae(value, "Called AE Title", False, False)
  File "/usr/local/lib/python3.9/site-packages/pynetdicom/utils.py", line 199, in set_ae
    raise ValueError(msg)
ValueError: Invalid 'Called AE Title' value 'LWPACS' - must not contain control characters or backslashes

‘LWPACS’ is not contains control characters or backslashes, why valid error?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mtolooncommented, Feb 19, 2022

The K-PACS sends the AE-Title with trailing \x00, but the default validator doesn’t accept it.:
SPAX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00

I fixed it by replacing the validator and remove the leading zero characters:
pynetdicom._config.VALIDATORS['AE'] = lambda x: pynetdicom._validators.validate_ae(x.strip(chr(0)))

Other clients such as dcm4chee doesn’t add \x00 padding

0reactions
scaramallioncommented, Feb 21, 2022

Hmm, I guess I could strip out nulls and warn instead of failing the validation.

Although doing so breaks the whole validator concept…

And I can’t leave nulls in because

>>> "foo" == "foo\0"
False
Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid 'Called AE Title' value 'LWPACS' - must not contain ...
Invalid 'Called AE Title' value 'LWPACS' - must not contain control characters or backslashes.
Read more >
Application Entity — pynetdicom 2.0.3 documentation
AE titles must meet the conditions of a DICOM data element with a Value ... excluding backslash ( \ - hex 0x5C )...
Read more >
2 AETitle Questions (spaces and foreign characters)
1) The DICOM Standard indicates that spaces are not allowed before or after the AETitle, but doesn't say if they are allowed within...
Read more >
pynetdicom/ae.rst at master - GitHub
The AE title can set by supplying the ae_title keyword parameter during ... excluding backslash ( \ - hex 0x5C ) and all...
Read more >
AE Title - OTpedia, Information for Medical Imaging
This parameter identifies the Application Entity (AE) that shall contain the requestor of the A-ASSOCIATE service. It is based on the Source DICOM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found