{"record":{"id":"6f936d4ad95a400c","repo":"slymnoyann/hey-1","slug":"something-went-wrong-6f936d","errorCode":null,"errorMessage":"Something went wrong!","messagePattern":"Something went wrong!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/components/Composer/NewPublication.tsx","lineNumber":223,"sourceCode":"      if (!hasValidVideoMetadata) {\n        setIsSubmitting(false);\n        return setPostContentError(\n          \"Add a valid video thumbnail before posting.\"\n        );\n      }\n\n      setPostContentError(\"\");\n\n      const baseMetadata = {\n        content: postContent.length > 0 ? postContent : undefined,\n        title: hasAudio\n          ? audioPost.title\n          : `${getTitlePrefix()} by ${getAccount(currentAccount).username}`\n      };\n\n      const metadata = getMetadata({ baseMetadata });\n      if (!metadata) {\n        throw new Error(ERRORS.SomethingWentWrong);\n      }\n\n      const contentUri = await uploadMetadata(metadata);\n\n      if (editingPost) {\n        umami.track(\"edit_post\");\n        return await editPost({\n          variables: { request: { contentUri, post: editingPost?.id } }\n        });\n      }\n\n      umami.track(isComment ? \"comment\" : isQuote ? \"quote\" : \"create_post\");\n      return await createPost({\n        variables: {\n          request: {\n            contentUri,\n            ...((feed || selectedFeed) && { feed: feed || selectedFeed }),\n            ...(isComment && { commentOn: { post: post?.id } }),","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/slymnoyann/hey-1/blob/88c8f9d55340d57a37846ff72f55c2c604e3a566/src/components/Composer/NewPublication.tsx#L205-L241","documentation":"Thrown by handleCreatePost in NewPublication.tsx when getMetadata returns a falsy value. getMetadata assembles the Lens-style publication metadata object (title, content, attachments, media); a null/undefined result means the current combination of post fields (audio post, video without thumbnail, empty content, etc.) doesn't map to any valid metadata type.","triggerScenarios":"Publishing with only unsupported attachment types, an audio post missing required fields, a video post where the thumbnail/duration preconditions fail, or an empty/whitespace-only publication so getMetadata can't determine the metadata type and returns undefined.","commonSituations":"UI state desync where the composer shows a post as ready but the underlying attachment store never finished uploading; a new attachment type added without extending getMetadata's type-matching; editing a legacy post whose stored shape no longer matches any metadata branch.","solutions":["Inspect composer state right before publish: verify content is non-empty and every attachment has uri + mimeType (this is the same precondition as usePostMetadata.assertUploadedAttachment)","Ensure video posts have a selected thumbnail and a parsed positive duration before enabling the post button","If you added a new media type, extend getMetadata's branching to handle it and return metadata","Catch ERRORS.SomethingWentWrong and show which field is invalid to disambiguate"],"exampleFix":"// before\nconst metadata = getMetadata({ baseMetadata });\nif (!metadata) {\n  throw new Error(ERRORS.SomethingWentWrong);\n}\n\n// after\nconst metadata = getMetadata({ baseMetadata });\nif (!metadata) {\n  throw new Error(\n    !baseMetadata.content?.trim()\n      ? \"Post content cannot be empty\"\n      : !attachments.every((a) => a.uri && a.mimeType)\n        ? \"Attachments are still uploading\"\n        : ERRORS.SomethingWentWrong\n  );\n}","handlingStrategy":"validation","validationCode":"const canBuildMetadata =\n  Boolean(baseMetadata.content?.trim()) &&\n  attachments.every((a) => a.uri && a.mimeType) &&\n  (!isVideoPost || (Boolean(videoThumbnail.url) && duration > 0));\nif (!canBuildMetadata) {\n  // block publish and show field-level feedback instead of calling handleCreatePost\n}","typeGuard":"const hasCompletePost = (p: {\n  content?: string;\n  attachments: { uri?: string; mimeType?: string }[];\n  videoThumbnail?: { url?: string };\n}): boolean =>\n  Boolean(p.content?.trim()) &&\n  p.attachments.every((a) => Boolean(a.uri && a.mimeType));","tryCatchPattern":"try {\n  await handleCreatePost();\n} catch (e) {\n  if (e instanceof Error && e.message === ERRORS.SomethingWentWrong) {\n    // re-check composer state and highlight the invalid field\n  }\n}","preventionTips":["Derive the publish button's disabled state from the same conditions getMetadata checks","Keep getMetadata's branch coverage in sync when adding new post/attachment types","Add unit tests over composer-state fixtures that previously produced undefined metadata"],"tags":["metadata","validation","lens","composer"],"backgroundTag":"metadata-validation-failed","analyzedSha":"88c8f9d55340d57a37846ff72f55c2c604e3a566","analyzedAt":"2026-08-28T16:20:43.640Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}