Skip to content

internal error: entered unreachable code #242

@paulyoung

Description

@paulyoung

As mentioned in dfinity/agent-rs#201 (comment), I have a canister written in Rust like this:

use ic_cdk_macros::{query};
use ic_utils_http_request::{HttpResponse, HttpRequest};

#[query]
fn http_request(request: HttpRequest) -> HttpResponse {
    HttpResponse {
        status_code: 200,
        headers: vec![],
        body: request.body.to_vec(),
        streaming_strategy: None,
    }
}

However, when I try to make a GET request via icx-proxy I get a 500 response and see this in the output from dfx start:

[Canister rrkah-fqaaa-aaaaa-aaaaq-cai] Panicked at 'internal error: entered unreachable code', /Users/py/.cargo/registry/src/github.com-1ecc6299db9ec823/candid-0.6.21/src/parser/value.rs:326:9

I started icx-proxy with -v -v so I see the GET request being logged.

I tried to curl the proxy instead and got Replica Error (5): "IC0502: Canister rrkah-fqaaa-aaaaa-aaaaq-cai trapped: unreachable"

I did this in Motoko first as part of testing dfinity/agent-rs#195 and didn't run into this.

Could someone help me understand if I'm doing something wrong here? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions