{"record":{"id":"6210301ae5d73d82","repo":"gleam-lang/gleam","slug":"unimplemented","errorCode":null,"errorMessage":"unimplemented","messagePattern":"unimplemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler-core/src/io/memory.rs","lineNumber":152,"sourceCode":"\n        // Remove any files in the directory\n        while let Some(file) = files\n            .keys()\n            .find(|file| file.as_path() != root && file.starts_with(path))\n        {\n            let file = file.clone();\n            let _ = files.remove(&file);\n        }\n\n        Ok(())\n    }\n\n    fn copy(&self, from: &Utf8Path, to: &Utf8Path) -> Result<(), Error> {\n        self.write_bytes(to, &self.read_bytes(from)?)\n    }\n\n    fn copy_dir(&self, _: &Utf8Path, _: &Utf8Path) -> Result<(), Error> {\n        panic!(\"unimplemented\") // TODO\n    }\n\n    fn mkdir(&self, path: &Utf8Path) -> Result<(), Error> {\n        // Traverse ancestors from parent to root.\n        // Create each missing ancestor.\n        for ancestor in path.ancestors() {\n            if ancestor == \"\" {\n                // Ignore the final ancestor of a relative path.\n                continue;\n            }\n            // Ensure we don't overwrite an existing file.\n            // We can ignore existing directories though.\n            let mut files = self.files.deref().borrow_mut();\n            if files.get(ancestor).is_some_and(|f| !f.is_directory()) {\n                return Err(Error::FileIo {\n                    kind: FileKind::Directory,\n                    action: FileIoAction::Create,\n                    path: ancestor.to_path_buf(),","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/gleam-lang/gleam/blob/15b07c783065c92bb016b1b74ed0995a5259850f/compiler-core/src/io/memory.rs#L134-L170","documentation":"The in-memory filesystem used for compiler testing/sandboxing (`compiler-core/src/io/memory.rs:152`) implements `copy_dir` as an explicit stub that panics with `\"unimplemented\"`. The `FileSystemReader`/writer trait allows directory copying, but the in-memory implementation never implemented it; any code path invoking it against the memory FS aborts immediately.","triggerScenarios":"Any operation that calls `copy_dir` on an `in-memory::FileSystem` — e.g. tests or tooling that use the memory FS and trigger a recursive directory copy (such as copying a project directory during build/packaging logic exercised in tests).","commonSituations":"Gleam compiler contributors running tests that exercise directory-copy code paths with the in-memory FS; library consumers using `gleam-core` with the memory FS backend for build operations that require `copy_dir`.","solutions":["Implement `copy_dir` in the memory FS: recursively `mkdir` the destination and `copy` each file via `read_dir`/`copy`.","Avoid the memory FS for operations needing directory copies; use the real filesystem wrapper instead.","Refactor the caller to copy files individually instead of relying on `copy_dir`.","Track/upvote the TODO in the source; until then treat memory-FS `copy_dir` as unavailable."],"exampleFix":"// before\nfn copy_dir(&self, _: &Utf8Path, _: &Utf8Path) -> Result<(), Error> {\n    panic!(\"unimplemented\") // TODO\n}\n// after\nfn copy_dir(&self, from: &Utf8Path, to: &Utf8Path) -> Result<(), Error> {\n    self.mkdir(to)?;\n    for entry in self.read_directory(from)? {\n        let f = from.join(&entry);\n        let t = to.join(&entry);\n        if self.is_directory(&f) { self.copy_dir(&f, &t)?; } else { self.copy(&f, &t)?; }\n    }\n    Ok(())\n}","handlingStrategy":"fallback","validationCode":"// avoid copy_dir on the in-memory FS\nif fs.supports_copy_dir() { fs.copy_dir(from, to)?; } else { copy_files_individually(...)?; }","typeGuard":null,"tryCatchPattern":"// no catchable error: this is a panic; feature-detect instead\nif is_memory_fs(fs) { /* implement manual recursive copy */ }","preventionTips":["Do not use the in-memory filesystem for operations requiring directory copies","Feature-detect the FS backend capability before calling copy_dir","Contribute an implementation for the TODO stub"],"tags":["panic","not-implemented","in-memory-filesystem","io","stub"],"backgroundTag":"method-not-implemented","analyzedSha":"15b07c783065c92bb016b1b74ed0995a5259850f","analyzedAt":"2026-09-14T11:14:59.388Z","contentChangedAt":"2026-09-14T11:14:59.388Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}