# "// running tests" shows "Your code raised an error", but it is not!

**URL:** <https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178>\
**Category:** freeCodeCamp Support\
**Tags:** python\
**Created:** [September 14, 2026, 5:03pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178 "2026-09-14T17:03:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![reThinker](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reThinker](https://forum.freecodecamp.org/u/reThinker)\
**Post date:** [September 14, 2026, 5:03pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/1 "2026-09-14T17:03:02Z")

</div>

I am learning python. In “step-20”:

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/python-v9/workshop-caesar-cipher/step-20)**
>
> Learn to Code for Free

( workshop-caesar-cipher/step-20 )

I see this error message:

```auto
1. Your code raised an error before any tests could run. Please fix it and try again.

```

while it is not the case. because:

1. it evens runs my entire code (added some prints in it and tested) and I also run it in an IDLE file without any error.

2. I reentered the previous step 19. did it again. So i got into step 20 automatically. There, without writing any code, I pressed “Check” button. This error massage appeared again!

What should I do? Any workarounds?

I attach my code here:

```auto
def caesar(text, shift):

    if not isinstance(shift, int):

        return 'Shift must be an integer value.'

    

    if shift < 1:

        return 'Shift must be a positive integer.'

    elif shift > 25:

        return 'Shift must be an integer between 1 and 25'

    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    shifted_alphabet = alphabet[shift:] + alphabet[:shift]

    translation_table = str.maketrans(alphabet + alphabet.upper(), shifted_alphabet + shifted_alphabet.upper())

    #print('Yes!!')

    return text.translate(translation_table)

encrypted_text = caesar('freeCodeCamp', 3)

print(encrypted_text+"\n\ndone!")

```

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [September 14, 2026, 5:51pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/2 "2026-09-14T17:51:37Z")

</div>

Hi @reThinker,

> Add a second condition to the `if` statement that checks if `shift` is greater than `25`. Remember that the logical OR operation in Python is implemented through the `or` operator.
> 
> Also, update the returned message to `Shift must be an integer between 1 and 25.`

> [@reThinker](#):
>
> ```auto
> if shift < 1:
> 
> return 'Shift must be a positive integer.'
> 
> ```

You were asked to add a second condition to the _existing_` if` statement and update the message, but instead you created an `elif` statement.

Happy coding

---

<div class="post-metadata">

**Author:** ![reThinker](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reThinker](https://forum.freecodecamp.org/u/reThinker)\
**Post date:** [September 16, 2026, 10:21pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/4 "2026-09-16T22:21:35Z")

</div>

Hi @dhess  
Honestly I ( at the moment ) am not trying to solve the logical error which of course I’ll do next. Now I just want to know why _ **"1. Your code raised an error before any tests could run** _" which is an interpreter error message, is shown and what is the remedy.

By the way thanks for the reply and helping in logic.  
I know you meant this:

```auto
    if not isinstance(shift, int):
        return 'Shift must be an integer value.'

    if shift < 1 or shift > 25:
        return 'Shift must be an integer between 1 and 25.'

```

However, what about interpreter error message?  
If it is a bug, where can I issue it?

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [September 17, 2026, 12:15pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/5 "2026-09-17T12:15:51Z")

</div>

To see assertion error(s) associated with the message “Your code raised an error before any tests could run”, please open your browser’s console.

---

<div class="post-metadata">

**Author:** ![reThinker](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reThinker](https://forum.freecodecamp.org/u/reThinker)\
**Post date:** [September 18, 2026, 12:14am UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/6 "2026-09-18T00:14:48Z")

</div>

@dhess It is already open (Both terminal and console). However there is nothing there because there is no error actually . Please note that IDLE runs the code without any errors. If I had an error, they would type some “Trace back… line…” message for me.

---

<div class="post-metadata">

**Author:** ![reThinker](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reThinker](https://forum.freecodecamp.org/u/reThinker)\
**Post date:** [September 20, 2026, 6:42pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/7 "2026-09-20T18:42:16Z")

</div>

Update: This was not solved because the message was not real. IDLE runs the code without any syntax or interpretation errors. I managed to find a workaround to the environment and close the step.

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [September 20, 2026, 8:00pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/9 "2026-09-20T20:00:00Z")

</div>

```auto
1. Your code raised an error before any tests could run. Please fix it and try again.

```

Your original code produced this error in the browser’s console, which is related to the first error message you got when you ran the tests:

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/d/f/9/df9f8369eaa502331325e446ff71b7afd6d110fc.png)

After you followed the directions by adding a second condition to the existing `if` statement and updating the message, your code passed the tests.

IDLE didn’t report an error on your original because there was no error in the code. The “error” was not following the directions in the instructions. The fCC tests are designed to check that you code is implemented as asked.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [September 20, 2026, 8:13pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/10 "2026-09-20T20:13:17Z")

</div>

that `26 =< shift` was a syntax error, and is now fixed (I don’t know if deployed), but it was in a part of the test that does not run if you write the correct expression

---

<div class="post-metadata">

**Author:** ![reThinker](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@reThinker](https://forum.freecodecamp.org/u/reThinker)\
**Post date:** [September 20, 2026, 9:00pm UTC](https://forum.freecodecamp.org/t/running-tests-shows-your-code-raised-an-error-but-it-is-not/800178/11 "2026-09-20T21:00:53Z")

</div>

Thanks for valuable reply to me. I was thinking why my browser’s console does not show any errors with “Trace back…” phrase and line number. Now I (think that) I understand it: That error messages were somewhere but I could not see them. May be I was not allowed (website user restriction) or it was beneath somewhere like my browser’s special debug panes. In the attached screenshot I see that there is an error in the checker. But I had my console pane empty. I even caused an error to see if there is another problem on my side. That intentional error raised a message though.

Anyway, your explanation here:

> IDLE didn’t report an error on your original because there was no error in the code. The “error” was not following the directions in the instructions. The fCC tests are designed to check that you code is implemented as asked.

closes my post and makes me satisfied 😄 I do not have that problem, nor that code now. Keeping forward 🫡
