# Error from course-sdk-js-tools while attempting to add/test a language to BYO HTTP Server

**URL:** https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128
**Category:** General
**Created:** [July 22, 2024, 2:12pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128 "2024-07-22T14:12:22Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ShonFrazier](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shonfrazier/32/1038_2.png) [@ShonFrazier](https://forum.codecrafters.io/u/ShonFrazier)
#### Post date: [July 22, 2024, 2:12pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/1 "2024-07-22T14:12:22Z")

</div>

I’m attempting to add Swift to the BYO HTTP Server challenge. I have read through the contributor guidelines, created a language folder in starter\_templates, and added a docker file to dockerfiles. I ran the `course-sdk test swift`– everything looked pretty good and it started running tests on the app built by my code. I fixed some minor problems with my source code and tried to test again, but now I get an error I don’t know how to diagnose. It seems to be from the `course-sdk-js-tools` container.

 ![Screenshot of error](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/c/c46b7605eebd7f871077a9feb0b5e1fbff7135c5.png)

What do I need to fix? I don’t know what file it wants that doesn’t exist. Thanks for your time - any help with this is most appreciated.

* * *

Edited to add text version of the error:

```plaintext
[docker-build] View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/8ccjevzdqw5movm2o0b5jkvf2

js-tools Docker image built.

Compiling language: swift...
17156 | return course3.languages.map((language8) => {
17157 | const globalFileDefinitions = glob2.sync(`${course3.globalStarterTemplatesDir}/**/*`, { dot: true }).filter((starterTemplateFilePath) => fs11.statSync(starterTemplateFilePath).isFile()).map((starterTemplateFilePath) => {
17158 | const destinationPath = path12.relative(course3.globalStarterTemplatesDir, starterTemplateFilePath);
17159 | return new SingleTemplateFileDefinition(destinationPath, path12.relative(course3.directory, starterTemplateFilePath));
17160 | });
17161 | const languageFileDefinitions = glob2.sync(`${starterTemplatesDir}/**/*`, { dot: true }).filter((starterTemplateFilePath) => fs11.statSync(starterTemplateFilePath).isFile()).map((starterTemplateFilePath) => {
                                                                                                                                                        ^
ENOENT: No such file or directory
   errno: -2
 syscall: "stat"

      at /$bunfs/root/main.out:17161:145
      at filter (:1:11)
      at /$bunfs/root/main.out:17161:102
      at map (:1:11)
      at definitions (/$bunfs/root/main.out:17461:67)
      at /$bunfs/root/main.out:17426:28
      at compileForLanguage (/$bunfs/root/main.out:17425:30)
      at /$bunfs/root/main.out:17514:44

Bun v1.1.17 (macOS x64)

```

---

<div class="post-metadata">

### Author: ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)
#### Post date: [July 30, 2024, 7:49pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/2 "2024-07-30T19:49:13Z")

</div>

@ShonFrazier I’ve been trying to replicate this but haven’t been able to yet. For context, the error occurs here:

> <https://github.com/codecrafters-io/course-sdk/blob/3758a3d06b03846ccd568ea5f4adc0a4b9790405/lib/models/starter-code-definition.ts#L90>

That’s supposed to be listing all items under starter\_templates/swift and **then** running `stat` on them. I’m sure there’s a simpler explanation here, but according to the code, the only expected case for this to fail would be if a file existed during `glob` and was deleted before `fs.statSync` ran, which seem… highly unlikely 🤔

@ShonFrazier some questions that could help narrow this down:

(a) Is this error persistent?  
(b) Could you try adding a console.log to the line, re-compiling course-sdk and seeing what you get? i.e. apply this diff:

 ![Screenshot 2024-07-30 at 20.48.07](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/8/81d871bca69b106973a93343d6909566e6c3bb44.png)

---

<div class="post-metadata">

### Author: ![ShonFrazier](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shonfrazier/32/1038_2.png) [@ShonFrazier](https://forum.codecrafters.io/u/ShonFrazier)
#### Post date: [July 30, 2024, 11:49pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/3 "2024-07-30T23:49:45Z")

</div>

Thanks for looking into this!

Question a): It is persistent. Cleaning and re-running the process results in the same error. I started from scratch on another Mac and got the same result.

Question b):

- the last file logged before the error is `.../build-your-own-http-server/starter_templates/swift/code/.build/x86_64-apple-macosx/debug/swift-nio_NIOPosix.bundle/PrivacyInfo.xcprivacy`
- that file is `lrwxr-xr-x 1 shon staff 28B Jul 21 22:11 .../build-your-own-http-server/starter_templates/swift/code/.build/x86_64-apple-macosx/debug/swift-nio_NIOPosix.bundle/PrivacyInfo.xcprivacy@ -> ../../.PrivacyInfo.xcprivacy`
- the file that the link points to is non-existent:

 ![Screenshot 2024-07-30 at 7.47.07 PM](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/c/c1eb089f13ef7c3275a4cf547492afc08afa384f.png)

I assume this file isn’t actually generated, but the link to it is. I’ll have to dig some more to know for certain.

EDIT: forgot the `-a` when I did the `ls` command for the screenshot, but it only adds `.` and `..`. The file `.PrivacyInfo.xcprivacy` is not there.

---

<div class="post-metadata">

### Author: ![ShonFrazier](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shonfrazier/32/1038_2.png) [@ShonFrazier](https://forum.codecrafters.io/u/ShonFrazier)
#### Post date: [July 31, 2024, 12:20am UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/4 "2024-07-31T00:20:36Z")

</div>

Giving this a bit more thought, it might be the difference between `lstat` on Linux, and `stat` on macOS (instructions say to link `lstat` to `stat`.) I can see about running this all on a Linux VM or container.

---

<div class="post-metadata">

### Author: ![ShonFrazier](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shonfrazier/32/1038_2.png) [@ShonFrazier](https://forum.codecrafters.io/u/ShonFrazier)
#### Post date: [August 1, 2024, 5:22pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/5 "2024-08-01T17:22:04Z")

</div>

On Linux, this error does not occur. But then it looks like there are some fragile string searches in the tests. First:

 ![Screenshot 2024-08-01 at 1.19.59 PM](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/c/cdff357a51e16ceec1b6441e540efed0cada4d2b.png)

and if I comment out that assertion:

 ![Screenshot 2024-08-01 at 1.19.19 PM](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/7/7a1321fad57314c680499f4d91836a46b377e844.png)

---

<div class="post-metadata">

### Author: ![ShonFrazier](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/shonfrazier/32/1038_2.png) [@ShonFrazier](https://forum.codecrafters.io/u/ShonFrazier)
#### Post date: [August 5, 2024, 1:13pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/6 "2024-08-05T13:13:54Z")

</div>

This problem was with Docker itself. The version installed by apt did not include buildx. Installing Docker with instructions from the Docker website solved it.

---

<div class="post-metadata">

### Author: ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)
#### Post date: [August 5, 2024, 1:50pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/7 "2024-08-05T13:50:39Z")

</div>

@ShonFrazier so the missing file error doesn’t happen now?

---

<div class="post-metadata">

### Author: ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)
#### Post date: [August 5, 2024, 3:37pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/8 "2024-08-05T15:37:36Z")

</div>

Think I’ve found the error! This happened to me locally when trying to add OCaml support, and it was because the file was a broken symlink. Working on a fix…

---

<div class="post-metadata">

### Author: ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)
#### Post date: [August 5, 2024, 5:37pm UTC](https://forum.codecrafters.io/t/error-from-course-sdk-js-tools-while-attempting-to-add-test-a-language-to-byo-http-server/1128/9 "2024-08-05T17:37:28Z")

</div>

Fixed here! [Fix error with broken symlinks + add OCaml support by rohitpaulk · Pull Request #35 · codecrafters-io/course-sdk · GitHub](https://github.com/codecrafters-io/course-sdk/pull/35)
