# Error implementing circuit on X8 machine

**URL:** <https://discuss.pennylane.ai/t/error-implementing-circuit-on-x8-machine/3334>\
**Category:** Strawberry Fields\
**Created:** [August 16, 2023, 5:51pm UTC](https://discuss.pennylane.ai/t/error-implementing-circuit-on-x8-machine/3334 "2023-08-16T17:51:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya\_Ranjan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/aditya_ranjan/32/1545_2.png) [@Aditya\_Ranjan](https://discuss.pennylane.ai/u/Aditya_Ranjan)\
**Post date:** [August 16, 2023, 5:51pm UTC](https://discuss.pennylane.ai/t/error-implementing-circuit-on-x8-machine/3334/1 "2023-08-16T17:51:17Z")

</div>

Hi there. I am trying to implement the following program on the X8 machine.

```auto
        s_abt=[1.9767559336493115, 4.758100468213858, 1.369620673054872, 
        1.8880582939476536, 6.419177455135756, 3.2882821050599693, 3.8345158683757177, 
        3.1152414521825516, 4.138611213886801, 5.234497111722375, 1.2591843035031594, 
        3.032897347227236]
        circuit1 = sf.Program(8)
        with circuit1.context as q:
            S2gate(1.0) | (q[0], q[4])
            S2gate(1.0) | (q[1], q[5])
            S2gate(1.0) | (q[2], q[6])
            S2gate(1.0) | (q[3], q[7])
            
            MZgate(s_abt[0], s_abt[1]) | (q[0], q[1])
            MZgate(s_abt[2], s_abt[3]) | (q[2], q[3])
            MZgate(s_abt[4], s_abt[5]) | (q[1], q[2])

            MZgate(s_abt[6], s_abt[7]) | (q[0], q[1])
            MZgate(s_abt[8], s_abt[9]) | (q[2], q[3])
            MZgate(s_abt[10], s_abt[11]) | (q[1], q[2])

            MZgate(s_abt[0], s_abt[1]) | (q[4], q[5])
            MZgate(s_abt[2], s_abt[3]) | (q[6], q[7])
            MZgate(s_abt[4], s_abt[5]) | (q[5], q[6])

            MZgate(s_abt[6], s_abt[7]) | (q[4], q[5])
            MZgate(s_abt[8], s_abt[9]) | (q[6], q[7])
            MZgate(s_abt[10], s_abt[11]) | (q[5], q[6])
            MeasureFock() | q
        
        eng = sf.RemoteEngine("X8_01")
        circuit1.compile(device=eng.device, compiler="Xunitary")
        circuit1.print()
        results = eng.run(circuit1, shots=n_samples, disable_port_permutation=True)

```

The above program does not run on the real machine, even though I can implement it in simulation. I have tried to run it a lot of times with no success.

```auto
S2gate(1, 0) | (q[0], q[4])
S2gate(1, 0) | (q[1], q[5])
S2gate(1, 0) | (q[2], q[6])
S2gate(1, 0) | (q[3], q[7])
MZgate(1.977, 4.758) | (q[0], q[1])
MZgate(1.37, 1.888) | (q[2], q[3])
MZgate(6.419, 3.288) | (q[1], q[2])
MZgate(3.835, 3.115) | (q[0], q[1])
MZgate(4.139, 5.234) | (q[2], q[3])
MZgate(1.259, 3.033) | (q[1], q[2])
MZgate(1.977, 4.758) | (q[4], q[5])
MZgate(1.37, 1.888) | (q[6], q[7])
MZgate(6.419, 3.288) | (q[5], q[6])
MZgate(3.835, 3.115) | (q[4], q[5])
MZgate(4.139, 5.234) | (q[6], q[7])
MZgate(1.259, 3.033) | (q[5], q[6])
MeasureFock | (q[0], q[1], q[2], q[3], q[4], q[5], q[6], q[7])
2023-08-16 13:38:06,808 - INFO - Compiling program for device X8_01 using compiler Xunitary.
2023-08-16 13:38:33,081 - ERROR - The remote job 390461a6-0c89-4aee-b397-3fb7d51f1951 failed due to an internal server error: {'error-code': 'bad-parameters-for-QPU', 'error-detail': 'The requested unitary and squeezing amplitudes could not be implemented on the quantum processing unit. If this error persists after multiple attempts, please contact technical support for possible solutions.'}. Please try again.

```

I am using the following packages -  
numpy 1.23.5  
StrawberryFields 0.23.0

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![kevinkawchak](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/kevinkawchak/32/1801_2.png) [@kevinkawchak](https://discuss.pennylane.ai/u/kevinkawchak)\
**Post date:** [August 16, 2023, 7:00pm UTC](https://discuss.pennylane.ai/t/error-implementing-circuit-on-x8-machine/3334/2 "2023-08-16T19:00:40Z")

</div>

> [@Aditya\_Ranjan](#):
>
> `bad-parameters-for-QPU`

Hello @Aditya_Ranjan,

Some details from [Executing programs on X8 devices — Strawberry Fields](https://strawberryfields.ai/photonics/demos/tutorial_X8.html)

Executing Jobs examples use a different approach to ops.MeasureFock()

Your S2gate appears to have correct parameters, but double check (r=1, phi=0) and (r=0, phi=0)

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [August 17, 2023, 9:14pm UTC](https://discuss.pennylane.ai/t/error-implementing-circuit-on-x8-machine/3334/3 "2023-08-17T21:14:01Z")

</div>

Hi @Aditya_Ranjan,

As @kevinkawchak noted the error message that you’re getting is telling you that something is wrong with the parameters. I don’t think it’s in the squeezing or the measurement but I may be wrong.

My recommendation would be to try some of the examples on the [X8 tutorial](https://strawberryfields.ai/photonics/demos/tutorial_X8.html) and modify it little by little until you understand which parameters are causing the issues.

Please let us know if you still have the error with the original tutorial programs or if you still cannot figure out the wrong parameter after changing line by line.

I hope this helps!
