# \[DNS Server\] #YC9 Overflowing header size

**URL:** <https://forum.codecrafters.io/t/dns-server-yc9-overflowing-header-size/15621>\
**Category:** Challenges\
**Tags:** challenge:dns-server\
**Created:** [December 4, 2025, 2:47pm UTC](https://forum.codecrafters.io/t/dns-server-yc9-overflowing-header-size/15621 "2025-12-04T14:47:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![natalka1122](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/natalka1122/32/14116_2.png) [@natalka1122](https://forum.codecrafters.io/u/natalka1122)\
**Post date:** [December 4, 2025, 2:47pm UTC](https://forum.codecrafters.io/t/dns-server-yc9-overflowing-header-size/15621/1 "2025-12-04T14:47:00Z")

</div>

I’m stuck on Stage #YC9. My DNS server handles compression in incoming packets correctly, and my outgoing responses are uncompressed. The tester is failing with:

> [tester::#YC9] DNS query failed: dns: overflowing header size.  
> [tester::#YC9] If you are seeing this after a while then it is likely that your server is not responding with appropriate id  
> [tester::#YC9] Test failed

Here are my packets:  
**Incoming request**

```python
b'o@\x01\x00\x00\x02\x00\x00\x00\x00\x00\x00\x03abc\x11longassdomainname\x03com\x00\x00\x01\x00\x01\x03def\xc0\x10\x00\x01\x00\x01'

```

```plaintext
DnsDatagram(questions=[Question(qname=b'abc.longassdomainname.com', qtype=<RecordType.A: 1>, qclass=<RecordClass.IN: 1>), Question(qname=b'def.longassdomainname.com', qtype=<RecordType.A: 1>, qclass=<RecordClass.IN: 1>)], resource_records=[], id=28480, qr=0, opcode=0, aa=0, tc=0, rd=1, ra=0, z=0, rcode=0, nscount=0, arcount=0)

```

**Outgoing response**

```python
b'o@\x81\x00\x00\x02\x00\x02\x00\x00\x00\x00\x03abc\x11longassdomainname\x03com\x00\x00\x01\x00\x01\x03def\x11longassdomainname\x03com\x00\x00\x01\x00\x01\x03abc\x11longassdomainname\x03com\x00\x00\x01\x00\x01\x00\x00\x00<\x00\x00\x00\x04\x08\x08\x08\x08\x03def\x11longassdomainname\x03com\x00\x00\x01\x00\x01\x00\x00\x00<\x00\x00\x00\x04\x08\x08\x08\x08'

```

```plaintext
DnsDatagram(questions=[Question(qname=b'abc.longassdomainname.com', qtype=<RecordType.A: 1>, qclass=<RecordClass.IN: 1>), Question(qname=b'def.longassdomainname.com', qtype=<RecordType.A: 1>, qclass=<RecordClass.IN: 1>)], resource_records=[ResourceRecord(rname=b'abc.longassdomainname.com', rtype=<RecordType.A: 1>, rclass=<RecordClass.IN: 1>, rttl=60, rdata='8.8.8.8'), ResourceRecord(rname=b'def.longassdomainname.com', rtype=<RecordType.A: 1>, rclass=<RecordClass.IN: 1>, rttl=60, rdata='8.8.8.8')], id=28480, qr=1, opcode=0, aa=0, tc=0, rd=1, ra=0, z=0, rcode=0, nscount=0, arcount=0)

```

The transaction ID matches correctly (28480), my flags are set right, I’m echoing back the everything properly. I have no idea what else could be wrong. Does this stage actually require compression in the response?

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [December 4, 2025, 5:50pm UTC](https://forum.codecrafters.io/t/dns-server-yc9-overflowing-header-size/15621/4 "2025-12-04T17:50:55Z")

</div>

Hey @natalka1122, the `RDLENGTH` field should be a 2-byte integer, instead of 4:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/e/c/ec9288af0325f288192488c4dce694196c950613.png)

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/a/8/a8b67867aa8c6b74729c1461d3f3a6b2b985dbe7.png)

Let me know if you’d like any further clarification!

---

<div class="post-metadata">

**Author:** ![natalka1122](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/natalka1122/32/14116_2.png) [@natalka1122](https://forum.codecrafters.io/u/natalka1122)\
**Post date:** [December 4, 2025, 7:42pm UTC](https://forum.codecrafters.io/t/dns-server-yc9-overflowing-header-size/15621/6 "2025-12-04T19:42:35Z")

</div>

Thank you so much! I passed this step.  
Although error message is kinda confusing

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [December 9, 2025, 7:43pm UTC](https://forum.codecrafters.io/t/dns-server-yc9-overflowing-header-size/15621/7 "2025-12-09T19:43:08Z")

</div>

Closed on December 9, 2025, 7:43pm UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
