<p>It turns out the contract being called from the <code>ContractInstance</code> has a delay that listens for change of state of a <code>StateMachine</code> until a certain deadline and hence hadn't completely executed the contract, which would consequently enable it publish the hooks and other details relating to the contract.</p>
<p>Calling an endpoint from the same <code>ContractInstance</code> led to the error.</p>

CC BY-SA 4.0
2021-10-15T03:40:37.537Z
2021-10-15T03:40:37.537Z
Aoaddeola
<p>I'm finding it difficult figuring out the cause of this hiccup. When I create an instance of a contract, the hooks are populated, but after calling an endpoint, the hooks list becomes empty.</p>
<p>Status of Contract Instance before endpoint invocation:</p>
<pre><code>{
    &quot;cicCurrentState&quot;: {
        &quot;observableState&quot;: null,
        &quot;logs&quot;: [],
        &quot;hooks&quot;: [
            {
                &quot;rqID&quot;: 2,
                &quot;itID&quot;: 1,
                &quot;rqRequest&quot;: {
                    &quot;aeMetadata&quot;: null,
                    &quot;aeDescription&quot;: {
                        &quot;getEndpointDescription&quot;: &quot;cancel-ob&quot;
                    }
                }
            },
            {
                &quot;rqID&quot;: 1,
                &quot;itID&quot;: 1,
                &quot;rqRequest&quot;: {
                    &quot;aeMetadata&quot;: null,
                    &quot;aeDescription&quot;: {
                        &quot;getEndpointDescription&quot;: &quot;create-ob&quot;
                    }
                }
            }
        ],
        &quot;err&quot;: null,
        &quot;lastLogs&quot;: []
    },
    &quot;cicContract&quot;: {
        &quot;unContractInstanceId&quot;: &quot;a39797ac-bbb6-449b-a389-35b096882df6&quot;
    },
    &quot;cicDefinition&quot;: &quot;OB&quot;,
    &quot;cicWallet&quot;: {
        &quot;getWallet&quot;: 2
    }
}
</code></pre>
<p>After endpoint invocation:</p>
<pre><code>{
    &quot;cicCurrentState&quot;: {
        &quot;observableState&quot;: {
            &quot;ttCurrencySymbol&quot;: {
                &quot;unCurrencySymbol&quot;: &quot;dffa71c3c512fe6ab8c0d72651a6122fb5d11042ef53d7131a47ca2c&quot;
            },
            &quot;ttOutRef&quot;: {
                &quot;txOutRefIdx&quot;: 1,
                &quot;txOutRefId&quot;: {
                    &quot;getTxId&quot;: &quot;b135806142f3d020fc68e9e72fa6e8e7c8fce34b2a0f17fd23b633641f58944a&quot;
                }
            }
        },
        &quot;logs&quot;: [
            {
                &quot;_logMessageContent&quot;: &quot;OB sent &quot;,
                &quot;_logLevel&quot;: &quot;Info&quot;
            }
        ],
        &quot;hooks&quot;: [],
        &quot;err&quot;: null,
        &quot;lastLogs&quot;: []
    },
    &quot;cicContract&quot;: {
        &quot;unContractInstanceId&quot;: &quot;a39797ac-bbb6-449b-a389-35b096882df6&quot;
    },
    &quot;cicDefinition&quot;: &quot;OB&quot;,
    &quot;cicWallet&quot;: {
        &quot;getWallet&quot;: 2
    }
}
</code></pre>
<p>After calling the endpoint, a <code>ThreadToken</code>  is returned, but all hooks are gone, thereby rendering the instance useless.</p>
<p>Example of what happens when an endpoint is called:</p>
<pre><code>EndpointCallError (EndpointNotAvailable (ContractInstanceId {unContractInstanceId = a39797ac-bbb6-449b-a389-35b096882df6}) (EndpointDescription {getEndpointDescription = &quot;cancel-ob&quot;}))
</code></pre>

CC BY-SA 4.0
2021-10-05T16:30:45.923Z
Endpoints will become unavailable for a given contract instance id when falling of the *happy path* (e.g. redeemer not validating). I see that you have no errors recorded though.

How do you have your endpoints hooked up and how did you test this behavior?
Matthias Sieber
<plutus><plutus-pab>
Hooks empty after calling endpoint
# Hooks empty after calling endpoint

(Asked by: username_0 on 2021-10-05)

I'm finding it difficult figuring out the cause of this hiccup. When I create an instance of a contract, the hooks are populated, but after calling an endpoint, the hooks list becomes empty.
Status of Contract Instance before endpoint invocation:
{
    "cicCurrentState": {
        "observableState": null,
        "logs": [],
        "hooks": [
            {
                "rqID": 2,
                "itID": 1,
                "rqRequest": {
                    "aeMetadata": null,
                    "aeDescription": {
                        "getEndpointDescription": "cancel-ob"
                    }
                }
            },
            {
                "rqID": 1,
                "itID": 1,
                "rqRequest": {
                    "aeMetadata": null,
                    "aeDescription": {
                        "getEndpointDescription": "create-ob"
                    }
                }
            }
        ],
        "err": null,
        "lastLogs": []
    },
    "cicContract": {
        "unContractInstanceId": "a39797ac-bbb6-449b-a389-35b096882df6"
    },
    "cicDefinition": "OB",
    "cicWallet": {
        "getWallet": 2
    }
}

After endpoint invocation:
{
    "cicCurrentState": {
        "observableState": {
            "ttCurrencySymbol": {
                "unCurrencySymbol": "dffa71c3c512fe6ab8c0d72651a6122fb5d11042ef53d7131a47ca2c"
            },
            "ttOutRef": {
                "txOutRefIdx": 1,
                "txOutRefId": {
                    "getTxId": "b135806142f3d020fc68e9e72fa6e8e7c8fce34b2a0f17fd23b633641f58944a"
                }
            }
        },
        "logs": [
            {
                "_logMessageContent": "OB sent ",
                "_logLevel": "Info"
            }
        ],
        "hooks": [],
        "err": null,
        "lastLogs": []
    },
    "cicContract": {
        "unContractInstanceId": "a39797ac-bbb6-449b-a389-35b096882df6"
    },
    "cicDefinition": "OB",
    "cicWallet": {
        "getWallet": 2
    }
}

After calling the endpoint, a ThreadToken  is returned, but all hooks are gone, thereby rendering the instance useless.
Example of what happens when an endpoint is called:
EndpointCallError (EndpointNotAvailable (ContractInstanceId {unContractInstanceId = a39797ac-bbb6-449b-a389-35b096882df6}) (EndpointDescription {getEndpointDescription = "cancel-ob"}))

**Tags:** plutus, plutus-pab
> **Comments:**
> **username_1**: Endpoints will become unavailable for a given contract instance id when falling of the *happy path* (e.g. redeemer not validating). I see that you have no errors recorded though.  How do you have your endpoints hooked up and how did you test this behavior?  

---

## 1 answers

### Answer by username_0 on 2021-10-15. Score: 0 | Accepted answer

It turns out the contract being called from the `ContractInstance` has a delay that listens for change of state of a `StateMachine` until a certain deadline and hence hadn't completely executed the contract, which would consequently enable it publish the hooks and other details relating to the contract.

Calling an endpoint from the same `ContractInstance` led to the error.


---

