Skip to content

[ISSUE] VectorSearch Error: failed to unmarshal response body: invalid character 'r' #1370

@jahmal23-lb

Description

@jahmal23-lb

Environment:
Go 1.24
github.com/databricks/databricks-sdk-go v0.92.0

Details:

Received unexpected error:

failed to unmarshal response body: invalid character 'r' after top-level value. This is likely a bug in the Databricks SDK for Go or the underlying REST API. Please report this issue with the following debugging information to the SDK issue tracker at https://github.com/databricks/databricks-sdk-go/issues.

Request log:

POST /api/2.0/vector-search/indexes/workspace.product-api-test.product_api_search_index/query
> * Host: 
> * Accept: application/json
> * Authorization: REDACTED
> * Content-Type: application/json
> * Traceparent: 00-351c8f26e191c2a29b6eea7a986c4cd4-5b5a424c0ce1e116-01
> * User-Agent: unknown/0.0.0 databricks-sdk-go/0.92.0 go/1.25.4 os/darwin auth/pat
> {
>   "columns": [
>     "id",
>     "description"
>   ],
>   "num_results": 2,
>   "query_text": "ergo tech"
> }
< HTTP/2.0 200 OK
< * Alt-Svc: clear
< * Content-Type: application/json
< * Date: Thu, 11 Dec 2025 21:26:47 GMT
< * Server: databricks
< * Server-Timing: request_id;dur=0;desc="9b066b31-4743-42c7-b2b6-1a13ab8fa68a", client_protocol;dur=0;desc="HTTP/2"
< * Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< * Vary: Accept-Encoding
< * X-Content-Type-Options: nosniff
< * X-Databricks-Org-Id: 2802660536935768
< * X-Request-Id: 9b066b31-4743-92c7-b2b6-1a13ab8fa68a
< {
<   "manifest": {
<     "column_count": 3,
<     "columns": [
<       {
<         "name": "id"
<       },
<       {
<         "name": "description"
<       },
<       {
<         "name": "score"
<       }
<     ]
<   },
<   "next_page_token": "",
<   "result": {
<     "data_array": [
<       [
<         1,
<         "Ergonomic wireless mouse with USB receiver",
<         0.002312242
<       ],
<       [
<         5,
<         "Non-slip yoga mat with carrying strap",
<         0.0021561543
<       ]
<     ],
<     "row_count": 2
<   }
< }

Calling Code:

func TestDatabricksVectorSearch(t *testing.T) {
	t.Run("successful vector search", func(t *testing.T) {
		api, err := databricks.NewWorkspaceClient(&databricks.Config{
			Host:        "GIT YOUR OWN WORKSPACE", // workspace url
			Token:       "GIT YOUR OWN TOKEN",                             // PAT
			Credentials: config.PatCredentials{},                          // enforce PAT auth
		})

		indexName := "workspace.product-api-test.product_api_search_index"

		results, err := api.VectorSearchIndexes.QueryIndex(context.Background(), vectorsearch.QueryVectorIndexRequest{
			IndexName:  indexName,
			QueryText:  "ergo tech",
			Columns:    []string{"id", "description"},
			NumResults: 2,
		})

		// Assertions
		require.NoError(t, err)
		assert.NotNil(t, results)
	})
}

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