Urgently need help with this Nix Error: exit status 1

I’m a new coder. I keep getting this when running my program, nix error: building nix env: exit status 1, Output has been trimmed to the last 20 lines. I have no idea why and I’m coding in java. I would really appreciate if the help team could go in and look at my code for me to debug it.
Repl link:

code snippet

Welcome to Ask! Could you please provide the link to your Repl so we can look at your code?



I hope this one works, if not lmk!

1 Like

Hi, I’m still quite stuck on this. Any chance you could help figure out what the issue is?

1 Like

Looking at your files and at the hidden file .replit, I cannot find Main.java, which is the file the Repl is attempting to run. If this file does not exist, this is a major problem. I cannot find any .java files.


There’s the missing main file, but also the replit.nix is not set up correctly. But since this looks like a school project I would ask your teacher to fix the Repl or have them get you a new template to work off of.


Thanks for checking that out. If that file doesn’t exist, can I just add it in and name it? Is it something that should’ve come with this project? Because I just opened the link from a Sophia course and so they had setup a file under my account so I could work on this particular project. I guess what are the next steps for me to have it run smoothly?

1 Like

Could you link to the course?

When you hit run, the .replit in the hidden files does this:

compile = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '*.java')"
run = "java -classpath .:target/dependency/* Main"
entrypoint = "Main.java"
hidden = ["**/*.class"]

If main.java isn’t there then it won’t run. It sounds like the course could be out of date.


For your nix error: run in Shell

sed -i 5,7d replit.nix

and in future make sure to watch out for whether text you entered is going into the Console/Shell instead of your files (i.e., the cursor in the Console/Shell is filled)
make sure that all files you want to run have a .java extension and the class you want to run is called Main and not BlackJackSimulation (and so the file must also be called Main.java)


Hi all, i’m just starting out and having a similar problem. the link to my project is here:


Thank you for any help you are able to offer :slight_smile:

(to add in case helpful, I was able to request a token and successfully get data from the Spotify API, but was also getting the Nix Error: exit status 1) response as well)

Hey @jonahweisz!

If you change your replit.nix file to:

{ pkgs }: {
  deps = [

Your issue will go away. Hope this helps!


Thanks a lot, it did! Much appreciated :slight_smile:

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