Galaxy API 101 - Used variables | AssertionError: expected -1 to be above -1

Hello there, I keep having this test fail on the Galaxy API 101 training. I have done it over and over. I have checked my variables just to be sure I did not miss anything. Please can point me in the right direction on how to go about this.

Here is a public link to this collection:


Can you show where you’re using the {{var_name}} syntax in a URL for that Collection, please?

Hello danny, Do you mean something like this

Do you have that variable set at the environment level and in both the initial and current fields?

I’m not familiar with that collection as I didn’t write it but there is a comment in the test script, that mentions it can only check the environment level.

No, I currently don’t have my variables saved as environment variables.
They were saved to the collection.

OK, try them in the environment variables instead and see if that has any impact on the results.

I have the same issue, I tried to save it to the env as well, without success.

i am also facing same issue. tried environment as well. but issue persist

I have this training modules (and its still passing).

It doesn’t need to be environment variables. Mine are set at the collection level.

It looks like the test is failing on this element (not the line posted in the original screenshot).

    //auth should also use var

Suspect this is looking at the authentication which is set at the collection level and is using the email_key variable. (It should be set at the collection level, not the ‘Learn APIs’ folder level).

When you run the collection status request, it logs a fair bit of into to the console.log.

The first entry shows the auth settings. Can you confirm if the value is set to the email_key variable?

here it is creating two.

Have you already sorted it out, cause I’m also struggling with the same problem. Apparently, we are not using the variables correctly, but other than that the internet seems to not have a solution for the problem.


Which I suspect is incorrect.

It should be the one entry.

I suspect you have authentication at the collection (Galaxy APIs 101) and also the folder level (Learn APIs).

You probably need to remove it from the folder level.

at folder level it is inherited from parent. i.e. (Galaxy APIs 101).
and if i removed it from folder level , then it also throws some more test to be failed. like saying auth error. :expressionless:


Leave the inherit from parent on the folder. It should be inherit from parent everywhere else apart from the collection.

I can only assume that you have this set somewhere else. You’ll need to check each request an folder and ensure they are all set to inherit from parent.

I think the test contains an error.

It currently has this: pm.expect(encodeURI(authObj.apikey.value).indexOf(‘%7B%7B’));

But authObj.apikey contains an array, not an object. It appears the intent of the test is to ensure that there are {{ contained in the value of apikey to indicate that a variable is used rather than a hardcoded value. I believe the test should instead be this:


1 Like


I’ve still got this saved in my collections and although I loathe to say it, it works for me.

The indexOf() method returns the position of the first occurrence of a value in a string.

The indexOf() method returns -1 if the value is not found.

The indexOf() method is case sensitive

I still think that its because the candidates have the authentication set in more than one place, where it should be at the collection level and inherit from parent should be set everywhere else.

There should only be one apikey in the response and it should be set to {{email_key}}

It shouldn’t be returning more than one element. Therefore authObj.apikey.value should normally work.

%7B in an URL is converted to {

So the test is basically testing to see if the authObj.apikey.value contains {{

Did anyone figure out exactly what is causing this issue? I just finished the Galaxy API 101 training and, but im getting this error. Please help.


There is another thread for this, where I’ve detailed what is causing it.

1 Like