{"record":{"id":"ec8751409270d655","repo":"pathwaycom/pathway","slug":"a-pinecone-api-key-is-required-pass-api-key-o","errorCode":null,"errorMessage":"A Pinecone API key is required. Pass api_key=... or set the PINECONE_API_KEY environment variable.","messagePattern":"A Pinecone API key is required\\. Pass api_key=\\.\\.\\. or set the PINECONE_API_KEY environment variable\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/pinecone/__init__.py","lineNumber":397,"sourceCode":"                    f\"column {col._name!r} is used as the {role} and cannot also \"\n                    \"be a metadata column. Remove it from metadata_columns.\"\n                )\n            metadata_names.append(col._name)\n\n    if batch_size <= 0:\n        raise ValueError(f\"batch_size must be a positive integer, got {batch_size}.\")\n\n    if pk_name is not None:\n        _check_primary_key_dtype(pk_name, table._get_column(pk_name).dtype)\n    _check_vector_dtype(vector_name, table._get_column(vector_name).dtype)\n    for col_name in metadata_names:\n        _check_metadata_dtype(col_name, table._get_column(col_name).dtype)\n\n    resolved_api_key = (\n        api_key if api_key is not None else os.environ.get(\"PINECONE_API_KEY\")\n    )\n    if not resolved_api_key:\n        raise ValueError(\n            \"A Pinecone API key is required. Pass api_key=... or set the \"\n            \"PINECONE_API_KEY environment variable.\"\n        )\n\n    column_index = {name_: index for index, name_ in enumerate(table.column_names())}\n    vector_index = column_index[vector_name]\n    metadata_indices = [column_index[name_] for name_ in metadata_names]\n\n    data_storage = api.DataStorage(\n        storage_type=\"pinecone\",\n        key_field_index=get_column_index(table, primary_key),\n        max_batch_size=batch_size,\n        pinecone_params=api.PineconeParams(\n            api_key=resolved_api_key,\n            index_name=index_name,\n            vector_index=vector_index,\n            metadata_indices=metadata_indices,\n            namespace=namespace,","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/pinecone/__init__.py#L379-L415","documentation":"Raised by pw.io.pinecone.write() when no Pinecone API key can be resolved: the api_key argument is None/empty and the PINECONE_API_KEY environment variable is unset or empty. Without a key the connector cannot authenticate upserts.","triggerScenarios":"Calling pw.io.pinecone.write(...) without api_key= while PINECONE_API_KEY is not exported in the process environment (common in cron jobs, CI, containers, new shells).","commonSituations":"Works locally (env var set in .bashrc) but fails in CI/Docker/systemd where the variable is not propagated; or passing api_key=\"\" instead of None.","solutions":["Pass the key explicitly: pw.io.pinecone.write(..., api_key=os.environ['PINECONE_API_KEY']).","Or export the variable in the environment the pipeline runs in: export PINECONE_API_KEY=... (and add it to your CI secrets / container env).","Never hardcode the key in source; load it from a secrets manager."],"exampleFix":"# before\npw.io.pinecone.write(t, \"docs\", vector=t.emb)  # PINECONE_API_KEY unset\n# after\nimport os\npw.io.pinecone.write(t, \"docs\", vector=t.emb, api_key=os.environ[\"PINECONE_API_KEY\"])","handlingStrategy":"validation","validationCode":"import os\napi_key = api_key or os.environ.get(\"PINECONE_API_KEY\")\nif not api_key:\n    raise RuntimeError(\"PINECONE_API_KEY is not set; refusing to build pipeline\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set PINECONE_API_KEY in the CI/deployment environment (secrets manager, docker --env-file).","Fail fast at startup with a clear message instead of deep inside pipeline construction.","Pass the key explicitly from your secrets layer when running in shared environments."],"tags":["pinecone","pathway","credentials","environment"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}