{"record":{"id":"974aac91b9d4a4de","repo":"yikart/AiToEarn","slug":"invalidworklink-974aac","errorCode":"InvalidWorkLink","errorMessage":"InvalidWorkLink","messagePattern":"InvalidWorkLink","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/instagram/instagram-work.provider.ts","lineNumber":63,"sourceCode":"          likeCount: media.like_count,\n          commentCount: media.comments_count,\n        },\n      })),\n      pagination: {\n        mode: ChannelPaginationMode.Cursor,\n        nextCursor: response.paging?.cursors?.after,\n        previousCursor: response.paging?.cursors?.before,\n        hasNext: Boolean(response.paging?.next),\n        hasPrevious: Boolean(response.paging?.previous),\n        limit,\n      },\n    }\n  }\n\n  async getLinkInfo(input: WorkLinkInfoInput): Promise<ChannelWorkDataResult> {\n    const shortcode = this.parseInstagramShortCode(input.link)\n    if (!shortcode || !input.dataId) {\n      throw new AppException(ResponseCode.InvalidWorkLink)\n    }\n    return {\n      snapshots: [],\n      work: {\n        id: input.dataId,\n        url: input.link,\n      },\n      extra: {\n        shortcode,\n        dataId: input.dataId,\n        resolvedUrl: input.link,\n      },\n    }\n  }\n\n  async getDetail(input: WorkDetailInput): Promise<ChannelWorkDataResult> {\n    const media = await this.instagramService.getMediaInfo(\n      input.credential.accessToken,","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/instagram/instagram-work.provider.ts#L45-L81","documentation":"getLinkInfo could not obtain both an Instagram shortcode from the link and a dataId. parseInstagramShortCode returned null/empty or input.dataId was missing, so the link isn't a usable Instagram work reference.","triggerScenarios":"Calling getLinkInfo with input.link that doesn't match an Instagram post/reel URL (no /p/<code>/ or /reel/<code>/ segment), or with a valid link but input.dataId undefined.","commonSituations":"Users paste profile or story URLs; the shortcode regex misses new formats (e.g. /share/reel/ links); caller forgot to supply dataId when the work record was created.","solutions":["Verify input.dataId is populated for the work being refreshed","Ensure the pasted link is a canonical instagram.com/p/<shortcode>/ or /reel/<shortcode>/ URL","Extend parseInstagramShortCode to accept the URL format users are pasting","Log input.link and parsed result to diagnose which of the two checks failed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const IG_RE = /instagram\\.com\\/(?:p|reel|reels|tv)\\/([A-Za-z0-9_-]+)/\nconst match = input.link?.match(IG_RE)\nif (!match || !input.dataId) {\n  throw new Error('Need an instagram.com/p|reel/<shortcode> URL and a dataId')\n}","typeGuard":"function isInstagramWorkInput(i: { link?: string; dataId?: string }): i is { link: string; dataId: string } {\n  return typeof i.link === 'string' && /instagram\\.com\\/(p|reel|tv)\\/[A-Za-z0-9_-]+/.test(i.link) && typeof i.dataId === 'string' && i.dataId.length > 0\n}","tryCatchPattern":null,"preventionTips":["Ensure dataId is captured when the work record is first created","Accept only canonical /p/, /reel/, /tv/ permalinks in the input UI","Update the shortcode parser when Instagram ships new share URL formats","Log both parsed shortcode and dataId to identify which check failed"],"tags":["instagram","url-parsing","link","validation"],"backgroundTag":"unsupported-work-link","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}