{"record":{"id":"ebea51634577b689","repo":"ruvnet/ruflo","slug":"pinata-jwt-required-config-pinatajwt-or-pinata-ap","errorCode":null,"errorMessage":"Pinata JWT required (config.pinataJwt or PINATA_API_JWT)","messagePattern":"Pinata JWT required \\(config\\.pinataJwt or PINATA_API_JWT\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/appliance/rvfa-distribution.ts","lineNumber":334,"sourceCode":"          { backupPath, newSize: newRvfa.length });\n      }\n    }\n\n    return { success: true, backupPath, newSize: newRvfa.length, patchedSection: sec, errors: [] };\n  }\n}\n\n// ── RvfaPublisher ────────────────────────────────────────────\nexport class RvfaPublisher {\n  private jwt: string;\n  private gw: string;\n  private api: string;\n\n  constructor(config: PublishConfig) {\n    this.jwt = config.pinataJwt || process.env.PINATA_API_JWT || '';\n    this.gw = (config.gatewayUrl || DEFAULT_GW).replace(/\\/+$/, '');\n    this.api = (config.apiUrl || DEFAULT_API).replace(/\\/+$/, '');\n    if (!this.jwt) throw new Error('Pinata JWT required (config.pinataJwt or PINATA_API_JWT)');\n  }\n\n  private async upload(\n    fileName: string, data: Buffer, kv: Record<string, string>,\n  ): Promise<PublishResult> {\n    const meta = JSON.stringify({ name: fileName, keyvalues: kv });\n    const { body, ct } = multipart('file', fileName, data, meta);\n    const res = await pinataReq('POST', `${this.api}/pinning/pinFileToIPFS`, this.jwt, body, ct);\n    if (res.status !== 200)\n      throw new Error(`Pinata upload failed (HTTP ${res.status}): ${JSON.stringify(res.data)}`);\n    const r = res.data as { IpfsHash: string; PinSize: number };\n    return {\n      cid: r.IpfsHash, size: r.PinSize,\n      gatewayUrl: `${this.gw}/ipfs/${r.IpfsHash}`, pinataUrl: `${this.api}/pinning/pins/${r.IpfsHash}`,\n    };\n  }\n\n  async publish(rvfaPath: string, meta?: PublishMetadata): Promise<PublishResult> {","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/appliance/rvfa-distribution.ts#L316-L352","documentation":"Thrown by the RvfaPublisher constructor when no Pinata JWT is available — neither in the passed PublishConfig.pinataJwt nor in the PINATA_API_JWT environment variable. The JWT is required as a Bearer token for every Pinata API call (upload, list, pin), so the publisher refuses to construct without it rather than failing on the first request.","triggerScenarios":"Constructing new RvfaPublisher({}) or createPublisher() without setting PINATA_API_JWT and without passing pinataJwt. Running in a CI/CD shell or container where the env var was not propagated, or calling createPublisher() in a fresh process.","commonSituations":"Local dev without the env var exported; deploy manifests that stripped secrets; the JWT was stored in a .env that was not loaded; a typo in the variable name (PINATA_JWT vs PINATA_API_JWT).","solutions":["Export PINATA_API_JWT in the environment before running the CLI: export PINATA_API_JWT=eyJ... (obtain from Pinata dashboard > Keys).","Pass it explicitly: new RvfaPublisher({ pinataJwt: process.env.MY_JWT }).","If using a .env file, ensure it is loaded (e.g. dotenv) before constructing the publisher.","Confirm the JWT is a valid Pinata API JWT, not an API key + secret pair (v1 vs v2 auth)."],"exampleFix":"// before\nconst pub = createPublisher(); // throws if PINATA_API_JWT unset\n\n// after\nconst pub = createPublisher({ pinataJwt: process.env.PINATA_API_JWT });\n// or: export PINATA_API_JWT=eyJ... before running the process","handlingStrategy":"validation","validationCode":"function resolvePinataJwt(config?: { pinataJwt?: string }): string | null {\n  return config?.pinataJwt || process.env.PINATA_API_JWT || null;\n}\n\nconst jwt = resolvePinataJwt();\nif (!jwt) {\n  throw new Error('Set PINATA_API_JWT env var or pass pinataJwt before constructing RvfaPublisher');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const pub = new RvfaPublisher(config);\n} catch (e) {\n  if (/Pinata JWT required/.test((e as Error).message)) {\n    throw new Error('No Pinata JWT found. Obtain one at https://app.pinata.cloud/keys and export PINATA_API_JWT');\n  }\n  throw e;\n}","preventionTips":["Always export PINATA_API_JWT in the shell or CI secret store before running publishing commands.","Load .env files (e.g. via dotenv) before constructing the publisher.","Use a Pinata v2 API JWT (not the legacy apiKey+apiSecret pair).","Fail fast at startup with a clear message if the JWT is missing."],"tags":["pinata","config","auth","ipfs"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}