PawanOsman / ChatGPT-Official

ChatGPT Client using official OpenAI API
MIT License
100 stars 23 forks source link

[Error: ENOENT: no such file or directory, rename './db.tmp.json' -> './db.json'] #8

Open lslzl3000 opened 1 year ago

lslzl3000 commented 1 year ago

Screenshot 2023-03-13 at 02 06 20

hugojerez commented 1 year ago

I got a similar problem, can't use this library in a read-only stateless docker

How can I disable db.json file?

we need this fix-eature please 🥺🌻

image
luandro commented 1 year ago

Nothing on this?

GabrieleRisso commented 7 months ago

I have the same problem, it has been a real headhake. My crappy patch has been to run this periodically: async function safeFileRename(sourcePath, destPath) { try { // Attempt to rename the file await fs.promises.rename(sourcePath, destPath); console.log(File renamed successfully: ${sourcePath} -> ${destPath}); } catch (error) { if (error.code === "ENOENT") { // Handle the case where the source file does not exist console.error("[!!] Source file does not exist:", sourcePath); } else { // Handle other errors console.error("[XX] Error renaming the file:", error.message); } } }

const sourcePath = "./db.tmp.json"; const destPath = "./db.json";

                safeFileRename(sourcePath, destPath).catch((error) => {
                    // Handle any uncaught errors here
                    console.error("[XX] An unhandled error occurred:", error);
                });