# Error when connecting to another task

**URL:** <https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625>\
**Category:** Online experiments\
**Created:** [May 23, 2020, 8:00pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625 "2020-05-23T20:00:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![cat500](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/cat500/32/7508_2.png) [@cat500](https://discourse.psychopy.org/u/cat500)\
**Post date:** [May 23, 2020, 8:00pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/1 "2020-05-23T20:00:26Z")

</div>

URL of experiment: [https://pavlovia.org/cmfo/noisi1\_s2](https://pavlovia.org/cmfo/noisi1_s2)

Description of the problem: I am running an online experiment that consists of three tasks in a row so I used the instructions given somewhere (I cannot seem to find it again, where I add the link to the next task to the psychopy task) and results in the following code:

```auto
// add info from the URL:
  util.addInfoFromUrl(expInfo);
  psychoJS.setRedirectUrls('https://run.pavlovia.org/cmfo/generationtask/html', '');

```

However, it seems to be failing quite often. At least half of the participants mention that the screen for the next experiment appears and then goes black. What is wrong? It was working normally before but now I am losing information on a lot of participants!

@jonathan.kominsky  
@jon

Best

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 24, 2020, 6:37am UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/2 "2020-05-24T06:37:34Z")

</div>

I think you should be using the following Completed URL to connect to your next task

`“[https://run.pavlovia.org/cmfo/generationtask/html/?participant=](https://run.pavlovia.org/cmfo/generationtask/html/?participant=)”+$expInfo[‘participant)’]

This method wouldn’t require anything in code components.

---

<div class="post-metadata">

**Author:** ![cat500](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/cat500/32/7508_2.png) [@cat500](https://discourse.psychopy.org/u/cat500)\
**Post date:** [May 28, 2020, 11:20pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/3 "2020-05-28T23:20:43Z")

</div>

That’s what I did, it still fails to do it correctly. I wish I could understand what is happening because I have lost data on at least 10 participants already.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 29, 2020, 5:48am UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/4 "2020-05-29T05:48:16Z")

</div>

I see that you’ve edited the name of the participant expInfo variable. I feel like that is likely to cause an issue for saving data and the redirection.

Has it ever worked since you did that? Please could you show the code you are using for the redirect? Are you trying to carry the participant ID to the next stage?

---

<div class="post-metadata">

**Author:** ![cat500](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/cat500/32/7508_2.png) [@cat500](https://discourse.psychopy.org/u/cat500)\
**Post date:** [June 16, 2020, 10:59pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/5 "2020-06-16T22:59:36Z")

</div>

@wakecarter I tried using this code on the complete URL but it does not allow me to press OK. Did I do something wrong? Is it because I changed the participant field to “Participant ID (Your initials and the last 5 digits of your phone number, example: JS45323)”?

```auto
“https://run.pavlovia.org/cmfo/generationtask/html/?participant= ”+ $expInfo['Participant ID (Your initials and the last 5 digits of your phone number, example: JS45323)']

```

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [June 17, 2020, 5:27am UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/6 "2020-06-17T05:27:07Z")

</div>

It may be that the punctuation in your participant question are the problem. If so, it would be good to identify which can’t be used. However, in the first instance you should remove the space after participant= and maybe the / after html so it’s html?participant=“+expInfo…

---

<div class="post-metadata">

**Author:** ![cat500](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/cat500/32/7508_2.png) [@cat500](https://discourse.psychopy.org/u/cat500)\
**Post date:** [June 17, 2020, 8:11pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/7 "2020-06-17T20:11:55Z")

</div>

Did what you suggested but still does not work, once it reaches the end it shows:

# 404 Not Found

nginx

Maybe @jon has a suggestion on how to do it for those of us who had to change the field for participant.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [June 17, 2020, 9:21pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/8 "2020-06-17T21:21:11Z")

</div>

I just took a look at your psyexp file to check your syntax but it just has [https://run.pavlovia.org/cmfo/pvt2/html](https://run.pavlovia.org/cmfo/pvt2/html) in the Completed URL for SRT Builder no ISI.

---

<div class="post-metadata">

**Author:** ![cat500](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/cat500/32/7508_2.png) [@cat500](https://discourse.psychopy.org/u/cat500)\
**Post date:** [June 18, 2020, 1:18am UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/9 "2020-06-18T01:18:02Z")

</div>

Sorry, I am trying it out on a trial task as the other tasks are already being used to collect data and I did not want to disrupt that. The task I am using to trial it out is this one: [https://run.pavlovia.org/cmfo/kjdgywdf/html](https://run.pavlovia.org/cmfo/kjdgywdf/html)

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [June 18, 2020, 8:15am UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/10 "2020-06-18T08:15:10Z")

</div>

I see you are making edits to the js file directly.

psychoJS.setRedirectUrls("“[https://run.pavlovia.org/cmfo/generationtask/html?participant=“+expInfo](https://run.pavlovia.org/cmfo/generationtask/html?participant=%E2%80%9C+expInfo)[‘Participant ID (Your initials and the last 5 digits of your phone number, example: JS45323)’]", ‘’);

isn’t going to work because it contains additional non-standard quotes. Try

`psychoJS.setRedirectUrls("https://run.pavlovia.org/cmfo/generationtask/html?participant="+expInfo['Participant ID (Your initials and the last 5 digits of your phone number, example: JS45323)']");`

However, I don’t know if this will work because I was talking about what to put in the PsychoPy file.

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [June 18, 2020, 12:00pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/11 "2020-06-18T12:00:41Z")

</div>

I agree that I think it’s the quotes. @wakecarter I actually edited your response to put the code into a code box (needs backticks or triple-bacticks) because otherwise Discrouse also make the quotes “smart” and therefore incorrect!

---

<div class="post-metadata">

**Author:** ![aisa2](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aisa2/32/8666_2.png) [@aisa2](https://discourse.psychopy.org/u/aisa2)\
**Post date:** [November 10, 2020, 10:42pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/12 "2020-11-10T22:42:05Z")

</div>

> Participant ID (Your initials and the last 5 digits of your phone number, example: JS45323)

I’m not sure what kind of ethics you have, but this might be too much identifying information. I know that isn’t the topic of the thread, but I thought it might be good to mention.

---

<div class="post-metadata">

**Author:** ![cat500](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/cat500/32/7508_2.png) [@cat500](https://discourse.psychopy.org/u/cat500)\
**Post date:** [November 10, 2020, 10:55pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/13 "2020-11-10T22:55:57Z")

</div>

Everything passes through the ethics committee and data management team and they approved it. Keep in mind this is an international study.

---

<div class="post-metadata">

**Author:** ![aisa2](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aisa2/32/8666_2.png) [@aisa2](https://discourse.psychopy.org/u/aisa2)\
**Post date:** [November 10, 2020, 11:35pm UTC](https://discourse.psychopy.org/t/error-when-connecting-to-another-task/13625/14 "2020-11-10T23:35:54Z")

</div>

Okay, good to know!
