Skip to content

[Bug] CreateIndexAsync Fails with JSON Deserialization Error ("vector_type" Missing) on local development #54

@legendaryleo7

Description

@legendaryleo7

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Attempting to create an index using CreateIndexAsync in the Pinecone .NET SDK throws a PineconeException with an inner JsonException stating that required properties (including vector_type) are missing during deserialization of the response.

Expected Behavior

I should be able to create indexes following the tutorial. Specifying VectorType in my create request should not trigger a deserialization exception that vector_type was missing.

Steps To Reproduce

Repro steps: Follow the steps in the Local development guide.

Start up a local database emulator with the following docker-compose file:

services:
  pinecone:
    image: ghcr.io/pinecone-io/pinecone-local:latest
    environment: 
      PORT: 5080
      PINECONE_HOST: localhost
    ports: 
      - "5080-5090:5080-5090"
    platform: linux/amd64

Create an index following the tutorial steps:

using Pinecone;

// Initialize a client.
// API key is required, but the value does not matter.
// When starting without indexes, disable TLS and
// provide the host and port of the Pinecone Local instance.
var pc = new PineconeClient("pclocal",
    new ClientOptions
    {
        BaseUrl = "http://localhost:5080",
        IsTlsEnabled = false
    }
);

// Create two indexes, one dense and one sparse
var denseIndexName = "dense-index";
var sparseIndexName = "sparse-index";

var createDenseIndexRequest = await pc.CreateIndexAsync(new CreateIndexRequest
{
    Name = denseIndexName,
    VectorType = VectorType.Dense,
    Dimension = 2,
    Metric = MetricType.Cosine,
    Spec = new ServerlessIndexSpec
    {
        Serverless = new ServerlessSpec
        {
            Cloud = ServerlessSpecCloud.Aws,
            Region = "us-east-1"
        }
    },
    DeletionProtection = DeletionProtection.Disabled,
    Tags = new Dictionary<string, string> 
    {  
        { "environment", "development" }
    }
});

Relevant log output

Exception details:

Pinecone.PineconeException: 'Failed to deserialize response'
JsonException: JSON deserialization for type 'Pinecone.Index' was missing required properties including: 'vector_type'.

This exception was originally thrown at this call stack:
    System.Text.Json.ThrowHelper.ThrowJsonException_JsonRequiredPropertyMissing(System.Text.Json.Serialization.Metadata.JsonTypeInfo, System.Collections.BitArray)
    System.Text.Json.Serialization.Converters.ObjectDefaultConverter<T>.OnTryRead(ref System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions, ref System.Text.Json.ReadStack, out T)
    System.Text.Json.Serialization.JsonConverter<T>.TryRead(ref System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions, ref System.Text.Json.ReadStack, out T, out bool)
    System.Text.Json.Serialization.JsonConverter<T>.ReadCore(ref System.Text.Json.Utf8JsonReader, out T, System.Text.Json.JsonSerializerOptions, ref System.Text.Json.ReadStack)
    System.Text.Json.Serialization.Metadata.JsonTypeInfo<T>.Deserialize(ref System.Text.Json.Utf8JsonReader, ref System.Text.Json.ReadStack)
    System.Text.Json.JsonSerializer.ReadFromSpan<TValue>(System.ReadOnlySpan<byte>, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue>, int?)
    System.Text.Json.JsonSerializer.ReadFromSpan<TValue>(System.ReadOnlySpan<char>, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue>)
    System.Text.Json.JsonSerializer.Deserialize<TValue>(string, System.Text.Json.JsonSerializerOptions)
    Pinecone.Core.JsonUtils.Deserialize<T>(string)
    Pinecone.BasePinecone.CreateIndexAsync(Pinecone.CreateIndexRequest, Pinecone.RequestOptions, System.Threading.CancellationToken)

Environment

- **OS**: Windows (with Docker)
- **Language version**: C# 13.0
- **Pinecone client version**: 4.0.2

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions