# 404 Not Found scenario fails CRLF

**URL:** <https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850>\
**Category:** Challenges\
**Tags:** challenge:http-server\
**Created:** [May 21, 2025, 1:00am UTC](https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850 "2025-05-21T01:00:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ola-dotun](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ola-dotun/32/11456_2.png) [@ola-dotun](https://forum.codecrafters.io/u/ola-dotun)\
**Post date:** [May 21, 2025, 1:00am UTC](https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850/1 "2025-05-21T01:00:24Z")

</div>

I’m stuck on Stage #ap6.

I’ve included `\r\n\r\n` in the 404 not found.

Here are my logs:

```auto
[tester::#AP6] Failed to read response: 
[tester::#AP6] Received: "TP/1.1 404 Not Found"
[tester::#AP6] ^ error
[tester::#AP6] Error: Expected CRLF after status line

```

And here’s a snippet of my code:

What I am returning in code is:

```rust
const HTTP_404: &str = "HTTP/1.1 404 Not Found\r\n\r\n";

```

---

<div class="post-metadata">

**Author:** ![ola-dotun](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ola-dotun/32/11456_2.png) [@ola-dotun](https://forum.codecrafters.io/u/ola-dotun)\
**Post date:** [May 21, 2025, 1:48am UTC](https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850/4 "2025-05-21T01:48:28Z")

</div>

I suspect the test runner trims the whitespace at the end of the string but still checks for CRLF.

---

<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:** [May 21, 2025, 2:08am UTC](https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850/5 "2025-05-21T02:08:04Z")

</div>

Hey @ola-dotun, I added a log before `if response.is_empty()` and confirmed that the response isn’t actually empty.

The issue is caused by `handle_file_path` returning `HTTP_404.to_string()`, which then gets trimmed:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/3/345ed018a355d121d46b1cda3af2bb1695d2fe30.jpeg)

BTW, `HTTP_404` doesn’t look correct either:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/b/b974441d80b956ac07a423170069beeddb3a5f36.png)

---

<div class="post-metadata">

**Author:** ![ola-dotun](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/ola-dotun/32/11456_2.png) [@ola-dotun](https://forum.codecrafters.io/u/ola-dotun)\
**Post date:** [May 21, 2025, 4:10am UTC](https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850/6 "2025-05-21T04:10:00Z")

</div>

Thanks @andy1li for helping me figure it out. I’m unblocked now.

---

<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:** [May 26, 2025, 6:07am UTC](https://forum.codecrafters.io/t/404-not-found-scenario-fails-crlf/10850/8 "2025-05-26T06:07:10Z")

</div>

Closed on May 26, 2025, 6:07am UTC

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