Skip to content

Utf8Error on get operation #75

Closed
Closed
@carolfly86

Description

@carolfly86

Hi,

I have a simple code to get document by key:

match block_on(_collection.get(key, GetOptions::default())) {
        Ok(r) => {
            let decoded: db::WritableEnvironment = match r.content(){
                Ok(environment) => environment,
                Err(e) => {
                    warn!("Unable to get couchbase document");
                    return Err(e.into());
                }
            };
            Ok(Some(decoded.into()))
        },
        Err(e) => {
            match e {
                CouchbaseError::DocumentNotFound {ctx: _} =>{
                    info!("couchbase document not found");
                    Ok(None)
                }
                _ => {
                    info!("get failed! {}", e);
                    Err(e.into())
                }            
            }
        }
    } 

This occasionally fails with below error:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 14, error_len: Some(1) }', /Users/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/couchbase-1.0.0-alpha.3/src/io/lcb/callbacks.rs:185:42

my couchbase document keys consists of 7 digits sha, double colons, and a short string containing character and digits.
For example the above error message is caused by trying to get this key 9a59b6e::S555

However, this error happens occasionally for different keys, and it may succeed in the next run.
Any idea what it could be? I'm using the 1.47.0-nightly version of rustc.

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